diff --git a/.npmignore b/.npmignore index 9c7e943..209a4c1 100644 --- a/.npmignore +++ b/.npmignore @@ -3,4 +3,5 @@ !dist/**/* !package.json !src/**/* -!test/**/* \ No newline at end of file +!test/**/* +!assets/* \ No newline at end of file diff --git a/demo/markupcheck.html b/demo/markupcheck.html new file mode 100644 index 0000000..9f9070c --- /dev/null +++ b/demo/markupcheck.html @@ -0,0 +1,78 @@ + + +
+
+/**
+ * @author John Smith
+ */
+@IsTest(Seealldata=true)
+public with sharing class L2Char implements Database.batchable {
+ public static final String ERROR = 0x0001;
+
+ @InvocableMethod(label='my invocable')
+ public static void moveTo(
+ Integer x,
+ Integer y,
+ Integer z
+ ) {
+
+
+ Account a = new Account();
+ a.Custom__c = 'stringvalue';
+ insert a;
+ Boolean ai = (Boolean) false;
+ System.debug('Should not be called');
+ if (1 > 5 && !Test.isRunningTest()) { // wtf!?
+ Database.insert(myAccounts, false);
+ }
+ }
+
+ @TestSetup
+ private static void makeData(Boolean a){
+ Custom__c c = new Custom__c();
+
+ for(Account a : acctLis ){
+ ConnectApi.insert a;
+ }
+ }
+
+ @isTest
+ private static void testme(){
+ System.assert(true);
+ }
+
+ @testVisible
+ private List<SelectOption> recordTypes { get; private set; }
+
+ for(Account a : [SELECT Id FROM Account WHERE LastModifiedDate = LAST_N_DAYS:3]){
+ Assert.fail();
+ }
+}
+
+trigger CTrig on Custom__c (before insert){
+ System.debug('inserting a record');
+ upsert myRecord__c;
+}
+
+
+
diff --git a/demo/soqlsamples.txt b/demo/soqlsamples.txt
new file mode 100644
index 0000000..0e0a1f4
--- /dev/null
+++ b/demo/soqlsamples.txt
@@ -0,0 +1,60 @@
+[SELECT
+ Account.Name,
+ (SELECT FIELDS(ALL) FROM Account.Contacts LIMIT 200)
+FROM Account]
+
+[SELECT Id, FIELDS(ALL) FROM User LIMIT 200]
+[SELECT
+ TYPEOF What
+ WHEN Account THEN Phone
+ ELSE Name
+ END
+FROM Event
+WHERE CreatedById IN
+ (
+ SELECT CreatedById
+ FROM Case
+ )]
+[SELECT
+ TYPEOF What
+ WHEN Account THEN Id, LastModifiedDate
+ WHEN Opportunity THEN Id
+ END
+FROM Task]
+[SELECT
+ TYPEOF What
+ WHEN Account THEN Phone, NumberOfEmployees
+ WHEN Opportunity THEN Amount, CloseDate
+ ELSE Name, Email
+ END
+FROM Event]
+[SELECT Id, (SELECT Id from OpportunityLineItems)
+FROM Opportunity
+WHERE Id IN
+ (
+ SELECT OpportunityId
+ FROM OpportunityLineItem
+ WHERE totalPrice > 10000
+ )]
+[SELECT Id FROM Account WHERE CreatedDate = NEXT_N_FISCAL_QUARTERS:6]
+[SELECT Id FROM Opportunity WHERE CloseDate = N_WEEKS_AGO:3]
+[SELECT Id FROM Account WHERE CreatedDate = YESTERDAY]
+[SELECT Id, MSP1__c from CustObj__c WHERE MSP1__c includes ('AAA;BBB','CCC')]
+[SELECT Id
+FROM Case
+WHERE Contact.LastName = null]
+[SELECT Title FROM Question WHERE LastReplyDate > 2005-10-08T01:02:03Z WITH DATA CATEGORY Geography__c AT (usa__c, uk__c)]
+[SELECT LeadSource, COUNT(Name) cnt
+FROM Lead
+GROUP BY ROLLUP(LeadSource)]
+[SELECT LeadSource, COUNT(Name) cnt
+FROM Lead
+GROUP BY ROLLUP(LeadSource)]
+[SELECT Name, MAX(Amount), MIN(Amount) min, SUM(Amount)
+FROM Opportunity
+GROUP BY Name]
+[SELECT LeadSource, Rating,
+ GROUPING(LeadSource) grpLS, GROUPING(Rating) grpRating,
+ COUNT(Name) cnt
+FROM Lead
+GROUP BY ROLLUP(LeadSource, Rating)]
\ No newline at end of file
diff --git a/dist/apex.es.min.js b/dist/apex.es.min.js
index 1b647d1..318a633 100644
--- a/dist/apex.es.min.js
+++ b/dist/apex.es.min.js
@@ -1,19 +1,19 @@
/*! `apex` grammar compiled for Highlight.js 11.9.0 */
var hljsGrammar=(()=>{"use strict";return e=>{
-const t=e.regex,a="[a-zA-Z][a-zA-Z_0-9]*",c="\\b"+a+"\\b",n="@"+a,s=/(?=\s*\()/,o=/\s+/,r=/\?\./,i=[{
+const t=e.regex,a="[a-zA-Z][a-zA-Z_0-9]*",c="\\b"+a+"\\b",n="@"+a,o=/(?=\s*\()/,s=/\s+/,r=/\?\./,i=[{
match:/(?>\=|>>>\=|\|\=/,/\&|~|\^|\|/,/<<|>>/,/<\=|>\=|\s(<|>)\s/,/\=\=|!\=/,/\=>/,/!(?=\w)/,/(?<=\s)(\?|:)(?=\s)/,r,/(?)/],g=A.concat(...h),y={
+},T=[/--/,/\+\+/,/\&\&|\|\|/,/\*\=|\/\=|\%\=|\+\=|-\=/,/\&\=|\^\=|<<\=|>>\=|>>>\=|\|\=/,/\&|~|\^|\|/,/<<|>>/,/<\=|>\=|\s(<|>)\s/,/\=\=|!\=/,/\=>/,/!(?=\w)/,/(?<=\s)(\?|:)(?=\s)/,r,/(?)/],g=A.concat(...h),y={
$pattern:t.concat(/(?/,/\<(?=\w)/,/\{|\}/,/\(|\)/,/\{|\}/),
-scope:"punctuation",relevance:0},T],D=e.inherit(e.APOS_STRING_MODE,{
+scope:"punctuation",relevance:0},R],C=e.inherit(e.APOS_STRING_MODE,{
scope:"string",relevance:0,contains:[{match:/\\'/,scope:"literal",relevance:0}]
-}),w=e.COMMENT("//",/[$\n]/,{relevance:0}),I=[e.COMMENT("/\\*","\\*/",{
+}),D=e.COMMENT("//",/[$\n]/,{relevance:0}),I=[e.COMMENT("/\\*","\\*/",{
relevance:0,contains:[{begin:/\w+@/,relevance:0},{
-match:[/@(?:exception|throws)/,o,a],scope:{1:"doctag",3:"title.class"},
+match:[/@(?:exception|throws)/,s,a],scope:{1:"doctag",3:"title.class"},
relevance:0},{begin:"@[A-Za-z_-]+",scope:"doctag",relevance:0},{
match:[/(?<=@param)\s+/,a],scope:{2:"variable"},relevance:0},{begin:"`",end:"`",
-scope:"string",contains:[e.BACKSLASH_ESCAPE],relevance:0}]}),w],_={
-match:t.either(...R),scope:"operator",relevance:0},U={match:/(?+/,endScope:"punctuation",contains:[{match:/\<|\,/,
scope:"punctuation"},{match:c,scope:"type"}],relevance:8},{
match:[t.optional(c),/\[/,t.optional(/\d+/),/\]/],scope:{1:"variable",
2:"punctuation",3:"number",4:"punctuation"}},{match:[a,/\[\]/],scope:{1:"type",
-2:"punctuation"},relevance:0}],f=[{match:t.concat(n,/\b(?!\s*\()/),scope:"meta"
+2:"punctuation"},relevance:0}],M=[{match:t.concat(n,/\b(?!\s*\()/),scope:"meta"
},{scope:"meta",begin:[t.concat(n,/\b/),/\s*/,/\(/],beginScope:{3:"punctuation"
},end:/\)/,endScope:"punctuation",contains:[{match:[c,/\s*=/],scope:{
-1:"keyword",2:"operator"},contains:[_]},D,p],keywords:{literal:S}}],k={
-match:[/\b[a-zA-Z0-9\.]*Exception/,o,a],scope:{1:"title.class",3:"variable"},
+1:"keyword",2:"operator"},contains:[_]},C,p],keywords:{literal:S}}],k={
+match:[/\b[a-zA-Z0-9\.]*Exception/,s,a],scope:{1:"title.class",3:"variable"},
relevance:0},F={match:[/(?])/],scope:{2:"variable"},
-relevance:0},Y={match:[/(?<=\=\s*\()/,a,"(?=\\)\\s*"+a+")"],scope:{2:"type"},
-relevance:0},P={match:[/\bnew\s+/,a,s],scope:{2:"type"},relevance:0};let W={
+relevance:0},P={match:[/(?<=\=\s*\()/,a,"(?=\\)\\s*"+a+")"],scope:{2:"type"},
+relevance:0},Y={match:[/\bnew\s+/,a,o],scope:{2:"type"},relevance:0};let W={
scope:"params_call",begin:/\(/,beginScope:"punctuation",end:/\)/,
endScope:"punctuation",relevance:0,keywords:y,contains:[]};const H=[{
-match:[/(?<=\.)/,a,s],scope:{2:"title.function.invoke"},relevance:1,
-contains:[...i],starts:W},{match:[/^\s*/,l(...b),a,s],scope:{
+match:[/(?<=\.)/,a,o],scope:{2:"title.function.invoke"},relevance:1,
+contains:[...i],starts:W},{match:[/^\s*/,l(...b),a,o],scope:{
3:"title.function.invoke"},relevance:1,starts:W}]
-;W.contains=[D,P,I,_,M,N,p,U,H,{keywords:{KEYWORDS:y},
+;W.contains=[C,Y,I,_,f,O,p,U,H,{keywords:{KEYWORDS:y},
match:t.concat(/(?<=\s|\(|\,)/,l(...S),a,/\b/,/(?!\.)/),scope:"variable",
relevance:0},{match:/\(|\,|\./,scope:"punctuation",relevance:0},{match:a,
scope:"variable"}];const x={scope:"params",end:/\)/,endScope:"punctuation",
-relevance:1,keywords:y,contains:[p,D,I,M,...N,{match:/\,|\(/,scope:"punctuation"
+relevance:1,keywords:y,contains:[p,C,I,f,...O,{match:/\,|\(/,scope:"punctuation"
},U,{match:[/(?<=\(|\,)\s*/,a,/(?=\s)/],scope:{2:"type"}},{
-match:[o,a,/\s*(?=[,)])/],scope:{2:"variable"}}]},G=[{
-begin:[/\btrigger/,o,a,o,"on",o,a],beginScope:{1:"keyword",3:"title.class",
-5:"operator",7:"type"},end:/(?=\{)/,returnEnd:!0,contains:[I,{begin:/\(/,
-end:/\)/,contains:[{
+match:[s,a,/\s*(?=[,)])/],scope:{2:"variable"}}]},G={
+match:[/\bswitch\s+on\s+/,a],scope:{1:"keyword",2:"variable"}};return{
+name:"Apex",aliases:["apex","lightning","soql"],case_insensitive:!0,
+disableAutodetect:!1,ignoreIllegals:!1,keywords:y,
+illegal:["","<#","<]","