From 4eb06b12d04bdc7e2f6f2a1f67b664b1f501b0b3 Mon Sep 17 00:00:00 2001 From: Andreas Arvidsson Date: Sat, 28 Feb 2026 09:34:17 +0100 Subject: [PATCH 1/8] Started working on missing clojure facets --- .../parseTree/clojure/changePair.yml | 25 ++ .../scopes/clojure/anonymousFunction.scope | 10 + .../scopes/clojure/anonymousFunction2.scope | 10 + .../scopes/clojure/disqualifyDelimiter.scope | 20 + .../scopes/clojure/functionCall.scope | 10 + .../scopes/clojure/functionCallee.scope | 13 + .../fixtures/scopes/clojure/ifStatement.scope | 41 ++ data/fixtures/scopes/clojure/list.scope | 10 + data/fixtures/scopes/clojure/list2.scope | 10 + data/fixtures/scopes/clojure/list3.scope | 10 + data/fixtures/scopes/clojure/map.scope | 10 + data/fixtures/scopes/clojure/map2.scope | 10 + .../namedFunction.iteration.document.scope | 12 + .../scopes/clojure/namedFunction.scope | 10 + .../scopes/clojure/string.multiLine.scope | 13 + .../scopes/clojure/string.singleLine.scope | 10 + .../clojure/textFragment.comment.line.scope | 10 + .../textFragment.string.multiLine.scope | 13 + .../textFragment.string.singleLine.scope | 10 + .../common/src/scopeSupportFacets/clojure.ts | 350 +++++++++++++++++- .../delimiterMaps.ts | 4 + queries/clojure.scm | 46 ++- 22 files changed, 651 insertions(+), 6 deletions(-) create mode 100644 data/fixtures/recorded/surroundingPair/parseTree/clojure/changePair.yml create mode 100644 data/fixtures/scopes/clojure/anonymousFunction.scope create mode 100644 data/fixtures/scopes/clojure/anonymousFunction2.scope create mode 100644 data/fixtures/scopes/clojure/disqualifyDelimiter.scope create mode 100644 data/fixtures/scopes/clojure/functionCall.scope create mode 100644 data/fixtures/scopes/clojure/functionCallee.scope create mode 100644 data/fixtures/scopes/clojure/ifStatement.scope create mode 100644 data/fixtures/scopes/clojure/list.scope create mode 100644 data/fixtures/scopes/clojure/list2.scope create mode 100644 data/fixtures/scopes/clojure/list3.scope create mode 100644 data/fixtures/scopes/clojure/map.scope create mode 100644 data/fixtures/scopes/clojure/map2.scope create mode 100644 data/fixtures/scopes/clojure/namedFunction.iteration.document.scope create mode 100644 data/fixtures/scopes/clojure/namedFunction.scope create mode 100644 data/fixtures/scopes/clojure/string.multiLine.scope create mode 100644 data/fixtures/scopes/clojure/string.singleLine.scope create mode 100644 data/fixtures/scopes/clojure/textFragment.comment.line.scope create mode 100644 data/fixtures/scopes/clojure/textFragment.string.multiLine.scope create mode 100644 data/fixtures/scopes/clojure/textFragment.string.singleLine.scope diff --git a/data/fixtures/recorded/surroundingPair/parseTree/clojure/changePair.yml b/data/fixtures/recorded/surroundingPair/parseTree/clojure/changePair.yml new file mode 100644 index 0000000000..30c5b54a27 --- /dev/null +++ b/data/fixtures/recorded/surroundingPair/parseTree/clojure/changePair.yml @@ -0,0 +1,25 @@ +languageId: clojure +command: + version: 7 + spokenForm: change pair + action: + name: clearAndSetSelection + target: + type: primitive + modifiers: + - type: containingScope + scopeType: {type: surroundingPair, delimiter: any} + usePrePhraseSnapshot: false +initialState: + documentContents: |- + "Hello + world" + selections: + - anchor: {line: 0, character: 0} + active: {line: 0, character: 0} + marks: {} +finalState: + documentContents: "" + selections: + - anchor: {line: 0, character: 0} + active: {line: 0, character: 0} diff --git a/data/fixtures/scopes/clojure/anonymousFunction.scope b/data/fixtures/scopes/clojure/anonymousFunction.scope new file mode 100644 index 0000000000..27a9f95a0b --- /dev/null +++ b/data/fixtures/scopes/clojure/anonymousFunction.scope @@ -0,0 +1,10 @@ +(fn [] 0) +--- + +[Content] = +[Removal] = +[Domain] = 0:0-0:9 + >---------< +0| (fn [] 0) + +[Insertion delimiter] = "\n" diff --git a/data/fixtures/scopes/clojure/anonymousFunction2.scope b/data/fixtures/scopes/clojure/anonymousFunction2.scope new file mode 100644 index 0000000000..7202d72250 --- /dev/null +++ b/data/fixtures/scopes/clojure/anonymousFunction2.scope @@ -0,0 +1,10 @@ +#(* % 2) +--- + +[Content] = +[Removal] = +[Domain] = 0:0-0:8 + >--------< +0| #(* % 2) + +[Insertion delimiter] = "\n" diff --git a/data/fixtures/scopes/clojure/disqualifyDelimiter.scope b/data/fixtures/scopes/clojure/disqualifyDelimiter.scope new file mode 100644 index 0000000000..3915696a3e --- /dev/null +++ b/data/fixtures/scopes/clojure/disqualifyDelimiter.scope @@ -0,0 +1,20 @@ +(< 1 2) +(> 1 2) +(<= 1 2) +(>= 1 2) +--- +[#1 Content] = 0:1-0:2 + >-< +0| (< 1 2) + +[#2 Content] = 1:1-1:2 + >-< +1| (> 1 2) + +[#3 Content] = 2:1-2:3 + >--< +2| (<= 1 2) + +[#4 Content] = 3:1-3:3 + >--< +3| (>= 1 2) diff --git a/data/fixtures/scopes/clojure/functionCall.scope b/data/fixtures/scopes/clojure/functionCall.scope new file mode 100644 index 0000000000..8dfbcd72cb --- /dev/null +++ b/data/fixtures/scopes/clojure/functionCall.scope @@ -0,0 +1,10 @@ +(foo) +--- + +[Content] = +[Removal] = +[Domain] = 0:0-0:5 + >-----< +0| (foo) + +[Insertion delimiter] = " " diff --git a/data/fixtures/scopes/clojure/functionCallee.scope b/data/fixtures/scopes/clojure/functionCallee.scope new file mode 100644 index 0000000000..2dbdd3015d --- /dev/null +++ b/data/fixtures/scopes/clojure/functionCallee.scope @@ -0,0 +1,13 @@ +(foo) +--- + +[Content] = +[Removal] = 0:1-0:4 + >---< +0| (foo) + +[Domain] = 0:0-0:5 + >-----< +0| (foo) + +[Insertion delimiter] = " " diff --git a/data/fixtures/scopes/clojure/ifStatement.scope b/data/fixtures/scopes/clojure/ifStatement.scope new file mode 100644 index 0000000000..aae0f8d8d9 --- /dev/null +++ b/data/fixtures/scopes/clojure/ifStatement.scope @@ -0,0 +1,41 @@ +(if true + aaa + (if false + bbb + ccc)) +--- + +[#1 Content] = +[#1 Removal] = +[#1 Domain] = 0:0-4:13 + >-------- +0| (if true +1| aaa +2| (if false +3| bbb +4| ccc)) + -------------< + +[#1 Insertion delimiter] = "\n" + + +[#2 Content] = +[#2 Domain] = 2:4-4:12 + >--------- +2| (if false +3| bbb +4| ccc)) + ------------< + +[#2 Removal] = 2:0-4:12 + >------------- +2| (if false +3| bbb +4| ccc)) + ------------< + +[#2 Leading delimiter] = 2:0-2:4 + >----< +2| (if false + +[#2 Insertion delimiter] = "\n" diff --git a/data/fixtures/scopes/clojure/list.scope b/data/fixtures/scopes/clojure/list.scope new file mode 100644 index 0000000000..40139bf939 --- /dev/null +++ b/data/fixtures/scopes/clojure/list.scope @@ -0,0 +1,10 @@ +[aaa bbb] +--- + +[Content] = +[Removal] = +[Domain] = 0:0-0:9 + >---------< +0| [aaa bbb] + +[Insertion delimiter] = " " diff --git a/data/fixtures/scopes/clojure/list2.scope b/data/fixtures/scopes/clojure/list2.scope new file mode 100644 index 0000000000..7261ba0780 --- /dev/null +++ b/data/fixtures/scopes/clojure/list2.scope @@ -0,0 +1,10 @@ +'[aaa bbb] +--- + +[Content] = +[Removal] = +[Domain] = 0:0-0:10 + >----------< +0| '[aaa bbb] + +[Insertion delimiter] = " " diff --git a/data/fixtures/scopes/clojure/list3.scope b/data/fixtures/scopes/clojure/list3.scope new file mode 100644 index 0000000000..84f9348900 --- /dev/null +++ b/data/fixtures/scopes/clojure/list3.scope @@ -0,0 +1,10 @@ +'(aaa bbb) +--- + +[Content] = +[Removal] = +[Domain] = 0:0-0:10 + >----------< +0| '(aaa bbb) + +[Insertion delimiter] = " " diff --git a/data/fixtures/scopes/clojure/map.scope b/data/fixtures/scopes/clojure/map.scope new file mode 100644 index 0000000000..79f40a9fbd --- /dev/null +++ b/data/fixtures/scopes/clojure/map.scope @@ -0,0 +1,10 @@ +{:aaa 0 :bbb 1} +--- + +[Content] = +[Removal] = +[Domain] = 0:0-0:15 + >---------------< +0| {:aaa 0 :bbb 1} + +[Insertion delimiter] = " " diff --git a/data/fixtures/scopes/clojure/map2.scope b/data/fixtures/scopes/clojure/map2.scope new file mode 100644 index 0000000000..d09bf85efd --- /dev/null +++ b/data/fixtures/scopes/clojure/map2.scope @@ -0,0 +1,10 @@ +'{:aaa 0 :bbb 1} +--- + +[Content] = +[Removal] = +[Domain] = 0:0-0:16 + >----------------< +0| '{:aaa 0 :bbb 1} + +[Insertion delimiter] = " " diff --git a/data/fixtures/scopes/clojure/namedFunction.iteration.document.scope b/data/fixtures/scopes/clojure/namedFunction.iteration.document.scope new file mode 100644 index 0000000000..4b13b944b9 --- /dev/null +++ b/data/fixtures/scopes/clojure/namedFunction.iteration.document.scope @@ -0,0 +1,12 @@ + +(defn foo [] 0) + +--- + +[Content] = +[Domain] = 0:0-2:0 + > +0| +1| (defn foo [] 0) +2| + < diff --git a/data/fixtures/scopes/clojure/namedFunction.scope b/data/fixtures/scopes/clojure/namedFunction.scope new file mode 100644 index 0000000000..39e64cc91c --- /dev/null +++ b/data/fixtures/scopes/clojure/namedFunction.scope @@ -0,0 +1,10 @@ +(defn foo [] 0) +--- + +[Content] = +[Removal] = +[Domain] = 0:0-0:15 + >---------------< +0| (defn foo [] 0) + +[Insertion delimiter] = "\n\n" diff --git a/data/fixtures/scopes/clojure/string.multiLine.scope b/data/fixtures/scopes/clojure/string.multiLine.scope new file mode 100644 index 0000000000..e8f7baaa0a --- /dev/null +++ b/data/fixtures/scopes/clojure/string.multiLine.scope @@ -0,0 +1,13 @@ +"Hello +world" +--- + +[Content] = +[Removal] = +[Domain] = 0:0-1:6 + >------ +0| "Hello +1| world" + ------< + +[Insertion delimiter] = " " diff --git a/data/fixtures/scopes/clojure/string.singleLine.scope b/data/fixtures/scopes/clojure/string.singleLine.scope new file mode 100644 index 0000000000..4b26cf31b3 --- /dev/null +++ b/data/fixtures/scopes/clojure/string.singleLine.scope @@ -0,0 +1,10 @@ +"Hello world" +--- + +[Content] = +[Removal] = +[Domain] = 0:0-0:13 + >-------------< +0| "Hello world" + +[Insertion delimiter] = " " diff --git a/data/fixtures/scopes/clojure/textFragment.comment.line.scope b/data/fixtures/scopes/clojure/textFragment.comment.line.scope new file mode 100644 index 0000000000..6ba8e375cc --- /dev/null +++ b/data/fixtures/scopes/clojure/textFragment.comment.line.scope @@ -0,0 +1,10 @@ +;; Hello world +--- + +[Content] = +[Removal] = +[Domain] = 0:0-0:14 + >--------------< +0| ;; Hello world + +[Insertion delimiter] = " " diff --git a/data/fixtures/scopes/clojure/textFragment.string.multiLine.scope b/data/fixtures/scopes/clojure/textFragment.string.multiLine.scope new file mode 100644 index 0000000000..2780f7ce95 --- /dev/null +++ b/data/fixtures/scopes/clojure/textFragment.string.multiLine.scope @@ -0,0 +1,13 @@ +"Hello +world" +--- + +[Content] = +[Removal] = +[Domain] = 0:1-1:5 + >----- +0| "Hello +1| world" + -----< + +[Insertion delimiter] = " " diff --git a/data/fixtures/scopes/clojure/textFragment.string.singleLine.scope b/data/fixtures/scopes/clojure/textFragment.string.singleLine.scope new file mode 100644 index 0000000000..85dcf5fa7f --- /dev/null +++ b/data/fixtures/scopes/clojure/textFragment.string.singleLine.scope @@ -0,0 +1,10 @@ +"Hello world" +--- + +[Content] = +[Removal] = +[Domain] = 0:1-0:12 + >-----------< +0| "Hello world" + +[Insertion delimiter] = " " diff --git a/packages/common/src/scopeSupportFacets/clojure.ts b/packages/common/src/scopeSupportFacets/clojure.ts index 3853f1358e..f23e440aba 100644 --- a/packages/common/src/scopeSupportFacets/clojure.ts +++ b/packages/common/src/scopeSupportFacets/clojure.ts @@ -1,9 +1,355 @@ import type { LanguageScopeSupportFacetMap } from "./scopeSupportFacets.types"; import { ScopeSupportFacetLevel } from "./scopeSupportFacets.types"; -// eslint-disable-next-line @typescript-eslint/no-unused-vars -const { supported, unsupported, notApplicable } = ScopeSupportFacetLevel; +const { supported, notApplicable } = ScopeSupportFacetLevel; export const clojureScopeSupport: LanguageScopeSupportFacetMap = { + disqualifyDelimiter: supported, + list: supported, + map: supported, + ifStatement: supported, + namedFunction: supported, + "namedFunction.iteration.document": supported, + anonymousFunction: supported, + functionCall: supported, + functionCallee: supported, + "argument.actual.singleLine": supported, + "argument.actual.multiLine": supported, + "argument.actual.iteration": supported, + "argument.formal.singleLine": supported, + "argument.formal.multiLine": supported, + "argument.formal.iteration": supported, + "argument.formal.lambda.singleLine": supported, + "argument.formal.lambda.multiLine": supported, + "argument.formal.lambda.iteration": supported, + "argumentList.actual.empty": supported, + "argumentList.actual.singleLine": supported, + "argumentList.actual.multiLine": supported, + "argumentList.formal.empty": supported, + "argumentList.formal.singleLine": supported, + "argumentList.formal.multiLine": supported, + "argumentList.formal.lambda.empty": supported, + "argumentList.formal.lambda.singleLine": supported, + "argumentList.formal.lambda.multiLine": supported, + "branch.if": supported, + "branch.if.else": supported, + "branch.if.iteration": supported, + "condition.if": supported, "comment.line": supported, + "string.singleLine": supported, + "string.multiLine": supported, + "textFragment.comment.line": supported, + "textFragment.string.singleLine": supported, + "textFragment.string.multiLine": supported, + "name.function": supported, + "name.argument.formal": supported, + "name.argument.formal.iteration": supported, + "name.argument.formal.lambda": supported, + "name.argument.formal.lambda.iteration": supported, + "interior.function": supported, + "interior.lambda": supported, + "interior.if": supported, + + /* NOT APPLICABLE */ + + // Assignment + "statement.assignment": notApplicable, + "statement.assignment.compound": notApplicable, + "statement.assignment.destructuring": notApplicable, + "name.assignment": notApplicable, + "name.assignment.compound": notApplicable, + "name.assignment.destructuring": notApplicable, + "value.assignment": notApplicable, + "value.assignment.compound": notApplicable, + "value.assignment.destructuring": notApplicable, + "statement.update": notApplicable, + + // Variable + "statement.variable.uninitialized": notApplicable, + "statement.variable.initialized": notApplicable, + "statement.variable.destructuring": notApplicable, + "name.variable.uninitialized": notApplicable, + "name.variable.initialized": notApplicable, + "name.variable.destructuring": notApplicable, + "type.variable.uninitialized": notApplicable, + "type.variable.initialized": notApplicable, + "value.variable": notApplicable, + "value.variable.destructuring": notApplicable, + + // Constant + "statement.constant": notApplicable, + "name.constant": notApplicable, + "value.constant": notApplicable, + "type.constant": notApplicable, + + // Class + class: notApplicable, + "class.iteration.class": notApplicable, + "class.iteration.document": notApplicable, + "name.class": notApplicable, + "name.field.class": notApplicable, + "name.iteration.class": notApplicable, + "statement.class": notApplicable, + "statement.field.class": notApplicable, + "statement.iteration.class": notApplicable, + "type.class": notApplicable, + "type.field.class": notApplicable, + "type.iteration.class": notApplicable, + "value.field.class": notApplicable, + "value.iteration.class": notApplicable, + "interior.class": notApplicable, + + // Constructor + "statement.constructor": notApplicable, + "namedFunction.constructor": notApplicable, + "argument.actual.constructor.singleLine": notApplicable, + "argument.actual.constructor.multiLine": notApplicable, + "argument.actual.constructor.iteration": notApplicable, + "argument.formal.constructor.singleLine": notApplicable, + "argument.formal.constructor.multiLine": notApplicable, + "argument.formal.constructor.iteration": notApplicable, + "argumentList.actual.constructor.empty": notApplicable, + "argumentList.actual.constructor.singleLine": notApplicable, + "argumentList.actual.constructor.multiLine": notApplicable, + "argumentList.formal.constructor.empty": notApplicable, + "argumentList.formal.constructor.singleLine": notApplicable, + "argumentList.formal.constructor.multiLine": notApplicable, + "interior.constructor": notApplicable, + "name.argument.formal.constructor": notApplicable, + "name.argument.formal.constructor.iteration": notApplicable, + "name.constructor": notApplicable, + "type.argument.formal.constructor": notApplicable, + "type.argument.formal.constructor.iteration": notApplicable, + "value.argument.formal.constructor": notApplicable, + "value.argument.formal.constructor.iteration": notApplicable, + "functionCall.constructor": notApplicable, + "functionCallee.constructor": notApplicable, + + // Method + "statement.method": notApplicable, + "namedFunction.method": notApplicable, + "argument.actual.method.singleLine": notApplicable, + "argument.actual.method.multiLine": notApplicable, + "argument.actual.method.iteration": notApplicable, + "argument.formal.method.singleLine": notApplicable, + "argument.formal.method.multiLine": notApplicable, + "argument.formal.method.iteration": notApplicable, + "argumentList.actual.method.empty": notApplicable, + "argumentList.actual.method.singleLine": notApplicable, + "argumentList.actual.method.multiLine": notApplicable, + "argumentList.formal.method.empty": notApplicable, + "argumentList.formal.method.singleLine": notApplicable, + "argumentList.formal.method.multiLine": notApplicable, + "interior.method": notApplicable, + "name.argument.formal.method": notApplicable, + "name.argument.formal.method.iteration": notApplicable, + "name.method": notApplicable, + "type.argument.formal.method": notApplicable, + "type.argument.formal.method.iteration": notApplicable, + "type.return.method": notApplicable, + "value.argument.formal.method": notApplicable, + "value.argument.formal.method.iteration": notApplicable, + "functionCall.method": notApplicable, + "functionCallee.method": notApplicable, + + // Function + "statement.function": notApplicable, + "namedFunction.iteration.class": notApplicable, + + // Function call + "statement.functionCall": notApplicable, + "functionCall.generic": notApplicable, + "functionCallee.generic": notApplicable, + "functionCall.chain": notApplicable, + "functionCallee.chain": notApplicable, + "name.argument.actual": notApplicable, + "name.argument.actual.iteration": notApplicable, + "value.argument.actual": notApplicable, + "value.argument.actual.iteration": notApplicable, + + // Return statement + "statement.return": notApplicable, + "type.return": notApplicable, + "value.return": notApplicable, + + // Yield statement + "statement.yield": notApplicable, + "value.yield": notApplicable, + + // Throw statement + "statement.throw": notApplicable, + "value.throw": notApplicable, + + // Interface + "statement.interface": notApplicable, + "statement.field.interface": notApplicable, + "statement.iteration.interface": notApplicable, + "interior.interface": notApplicable, + "name.interface": notApplicable, + "name.field.interface": notApplicable, + "name.iteration.interface": notApplicable, + "type.interface": notApplicable, + "type.field.interface": notApplicable, + "value.field.interface": notApplicable, + "type.iteration.interface": notApplicable, + + // Enum + "statement.enum": notApplicable, + "functionCallee.enum": notApplicable, + "functionCall.enum": notApplicable, + "name.enum": notApplicable, + "name.field.enum": notApplicable, + "name.iteration.enum": notApplicable, + "value.field.enum": notApplicable, + "value.iteration.enum": notApplicable, + "type.enum": notApplicable, + "interior.enum": notApplicable, + + // Command + command: notApplicable, + "statement.command": notApplicable, + "name.command": notApplicable, + "value.command": notApplicable, + "interior.command": notApplicable, + + // Try catch + "statement.try": notApplicable, + "branch.try": notApplicable, + "branch.try.iteration": notApplicable, + "interior.try": notApplicable, + "argument.catch": notApplicable, + "name.argument.catch": notApplicable, + "type.argument.catch": notApplicable, + + // If statement + "statement.if": notApplicable, + "branch.if.elif.else": notApplicable, + + // Switch statement + "statement.switch": notApplicable, + "branch.switchCase": notApplicable, + "branch.switchCase.iteration": notApplicable, + "condition.switchCase": notApplicable, + "condition.switchCase.iteration": notApplicable, + "interior.switch": notApplicable, + "interior.switchCase": notApplicable, + "value.switch": notApplicable, + + // Loop + "branch.loop": notApplicable, + "branch.loop.iteration": notApplicable, + + // For loop + "statement.for": notApplicable, + "condition.for": notApplicable, + "interior.for": notApplicable, + + // For-each loop + "statement.foreach": notApplicable, + "interior.foreach": notApplicable, + "name.foreach": notApplicable, + "type.foreach": notApplicable, + "value.foreach": notApplicable, + + // While loop + "statement.while": notApplicable, + "condition.while": notApplicable, + "interior.while": notApplicable, + + // Do-while loop + "statement.doWhile": notApplicable, + "condition.doWhile": notApplicable, + "interior.doWhile": notApplicable, + + // Resource statement + "statement.resource": notApplicable, + "interior.resource": notApplicable, + "name.resource": notApplicable, + "type.resource": notApplicable, + "value.resource": notApplicable, + + // Static + "statement.static": notApplicable, + "interior.static": notApplicable, + + // Namespace + "statement.namespace": notApplicable, + "interior.namespace": notApplicable, + "name.namespace": notApplicable, + + // Ternary + "branch.ternary": notApplicable, + "branch.ternary.iteration": notApplicable, + "condition.ternary": notApplicable, + + // Section + section: notApplicable, + "section.iteration.document": notApplicable, + "section.iteration.parent": notApplicable, + + // Element + element: notApplicable, + "interior.element": notApplicable, + "textFragment.element": notApplicable, + tags: notApplicable, + startTag: notApplicable, + endTag: notApplicable, + + // Attribute + attribute: notApplicable, + "key.attribute": notApplicable, + "value.attribute": notApplicable, + + // Notebook cell + notebookCell: notApplicable, + "interior.cell": notApplicable, + + // Type alias + "type.alias": notApplicable, + "statement.typeAlias": notApplicable, + "name.typeAlias": notApplicable, + "value.typeAlias": notApplicable, + + // Collection item + "collectionItem.unenclosed.singleLine": notApplicable, + "collectionItem.unenclosed.multiLine": notApplicable, + "collectionItem.unenclosed.iteration": notApplicable, + + // Miscellaneous statements + "statement.misc": notApplicable, + "statement.break": notApplicable, + "statement.continue": notApplicable, + "statement.package": notApplicable, + "statement.import": notApplicable, + "statement.iteration.document": notApplicable, + "statement.iteration.block": notApplicable, + + // Miscellaneous + "comment.block": notApplicable, + environment: notApplicable, + fieldAccess: notApplicable, + "key.mapPair": notApplicable, + "key.mapPair.iteration": notApplicable, + "name.iteration.block": notApplicable, + "name.iteration.document": notApplicable, + pairDelimiter: notApplicable, + regularExpression: notApplicable, + "type.argument.formal": notApplicable, + "type.argument.formal.iteration": notApplicable, + "type.argument.formal.lambda": notApplicable, + "type.argument.formal.lambda.iteration": notApplicable, + "type.cast": notApplicable, + "type.typeArgument": notApplicable, + "type.typeArgument.iteration": notApplicable, + "type.iteration.block": notApplicable, + "type.iteration.document": notApplicable, + "value.argument.formal": notApplicable, + "value.argument.formal.iteration": notApplicable, + "value.iteration.block": notApplicable, + "value.iteration.document": notApplicable, + "value.mapPair": notApplicable, + "value.mapPair.iteration": notApplicable, + "value.return.lambda": notApplicable, + selector: notApplicable, + unit: notApplicable, }; diff --git a/packages/cursorless-engine/src/processTargets/modifiers/scopeHandlers/SurroundingPairScopeHandler/delimiterMaps.ts b/packages/cursorless-engine/src/processTargets/modifiers/scopeHandlers/SurroundingPairScopeHandler/delimiterMaps.ts index 411d41f816..f6fb40546b 100644 --- a/packages/cursorless-engine/src/processTargets/modifiers/scopeHandlers/SurroundingPairScopeHandler/delimiterMaps.ts +++ b/packages/cursorless-engine/src/processTargets/modifiers/scopeHandlers/SurroundingPairScopeHandler/delimiterMaps.ts @@ -75,6 +75,10 @@ const delimiterToTextOverrides: Record> = { tripleDoubleQuotes: ["%Q(", ")"], }, + clojure: { + doubleQuotes: ['"', '"', { isSingleLine: false }], + }, + csharp: { doubleQuotes: [ ['@"', '"'], diff --git a/queries/clojure.scm b/queries/clojure.scm index 4a6dbdb357..b6f6e9aa8a 100644 --- a/queries/clojure.scm +++ b/queries/clojure.scm @@ -1,14 +1,47 @@ ;; https://github.com/sogaiu/tree-sitter-clojure/blob/master/src/grammar.json +(source) @namedFunction.iteration + +;;!! ;; Hello world +;;! ^^^^^^^^^^^^^^ (comment) @comment @textFragment -(str_lit) @string @textFragment +;;!! "Hello world" +;;! ^^^^^^^^^^^^^ +;;! ^^^^^^^^^^^ +( + (str_lit) @string @textFragment + (#character-range! @textFragment 1 -1) +) -(map_lit) @map +;;!! {:aaa 0 :bbb 1} +;;! ^^^^^^^^^^^^^^^ +( + (map_lit) @map + (#not-parent-type? @map quoting_lit) +) -;; A list is either a vector literal or a quoted list literal -(vec_lit) @list +;;!! '{:aaa 0 :bbb 1} +;;! ^^^^^^^^^^^^^^^^ +(quoting_lit + (map_lit) +) @map +;;!! [aaa bbb] +;;! ^^^^^^^^^ +( + (vec_lit) @list + (#not-parent-type? @list quoting_lit) +) + +;;!! '[aaa bbb] +;;! ^^^^^^^^^^ +(quoting_lit + (vec_lit) +) @list + +;;!! '(aaa bbb) +;;! ^^^^^^^^^^ (quoting_lit (list_lit) ) @list @@ -161,3 +194,8 @@ "{" @collectionKey.iteration.start.endOf @value.iteration.start.endOf "}" @collectionKey.iteration.end.startOf @value.iteration.end.startOf ) + +( + (sym_name) @disqualifyDelimiter + (#text? @disqualifyDelimiter "<" ">" "<=" ">=") +) From 5f88e10fc71bd3f47079feeb92c60ff13dc5a5fd Mon Sep 17 00:00:00 2001 From: Andreas Arvidsson Date: Sat, 28 Feb 2026 09:50:56 +0100 Subject: [PATCH 2/8] if --- .../clojure/branch/branch.if.else.scope | 37 +++++++++++++++++ .../clojure/branch/branch.if.iteration.scope | 12 ++++++ .../scopes/clojure/branch/branch.if.scope | 18 +++++++++ .../scopes/clojure/condition.if.scope | 25 ++++++++++++ .../fixtures/scopes/clojure/ifStatement.scope | 40 ++++--------------- .../scopes/clojure/name/name.function.scope | 24 +++++++++++ .../common/src/scopeSupportFacets/clojure.ts | 8 ++-- queries/clojure.scm | 19 ++++++++- 8 files changed, 146 insertions(+), 37 deletions(-) create mode 100644 data/fixtures/scopes/clojure/branch/branch.if.else.scope create mode 100644 data/fixtures/scopes/clojure/branch/branch.if.iteration.scope create mode 100644 data/fixtures/scopes/clojure/branch/branch.if.scope create mode 100644 data/fixtures/scopes/clojure/condition.if.scope create mode 100644 data/fixtures/scopes/clojure/name/name.function.scope diff --git a/data/fixtures/scopes/clojure/branch/branch.if.else.scope b/data/fixtures/scopes/clojure/branch/branch.if.else.scope new file mode 100644 index 0000000000..2d575933f6 --- /dev/null +++ b/data/fixtures/scopes/clojure/branch/branch.if.else.scope @@ -0,0 +1,37 @@ +(if true + aaa + bbb) +--- + +[#1 Content] = +[#1 Domain] = 1:4-1:7 + >---< +1| aaa + +[#1 Removal] = 1:0-2:0 + >------- +1| aaa +2| bbb) + < + +[#1 Leading delimiter] = 1:0-1:4 + >----< +1| aaa + +[#1 Insertion delimiter] = "\n" + + +[#2 Content] = +[#2 Domain] = 2:4-2:7 + >---< +2| bbb) + +[#2 Removal] = 2:0-2:7 + >-------< +2| bbb) + +[#2 Leading delimiter] = 2:0-2:4 + >----< +2| bbb) + +[#2 Insertion delimiter] = "\n" diff --git a/data/fixtures/scopes/clojure/branch/branch.if.iteration.scope b/data/fixtures/scopes/clojure/branch/branch.if.iteration.scope new file mode 100644 index 0000000000..c70aed374e --- /dev/null +++ b/data/fixtures/scopes/clojure/branch/branch.if.iteration.scope @@ -0,0 +1,12 @@ +(if true + aaa + bbb) +--- + +[Content] = +[Domain] = 0:0-2:8 + >-------- +0| (if true +1| aaa +2| bbb) + --------< diff --git a/data/fixtures/scopes/clojure/branch/branch.if.scope b/data/fixtures/scopes/clojure/branch/branch.if.scope new file mode 100644 index 0000000000..0334b3289c --- /dev/null +++ b/data/fixtures/scopes/clojure/branch/branch.if.scope @@ -0,0 +1,18 @@ +(if true + aaa) +--- + +[Content] = +[Domain] = 1:4-1:7 + >---< +1| aaa) + +[Removal] = 1:0-1:7 + >-------< +1| aaa) + +[Leading delimiter] = 1:0-1:4 + >----< +1| aaa) + +[Insertion delimiter] = "\n" diff --git a/data/fixtures/scopes/clojure/condition.if.scope b/data/fixtures/scopes/clojure/condition.if.scope new file mode 100644 index 0000000000..a7e84484d6 --- /dev/null +++ b/data/fixtures/scopes/clojure/condition.if.scope @@ -0,0 +1,25 @@ +(if true + aaa + bbb) +--- + +[Content] = 0:4-0:8 + >----< +0| (if true + +[Removal] = 0:3-0:8 + >-----< +0| (if true + +[Leading delimiter] = 0:3-0:4 + >-< +0| (if true + +[Domain] = 0:0-2:8 + >-------- +0| (if true +1| aaa +2| bbb) + --------< + +[Insertion delimiter] = " " diff --git a/data/fixtures/scopes/clojure/ifStatement.scope b/data/fixtures/scopes/clojure/ifStatement.scope index aae0f8d8d9..3417a28c37 100644 --- a/data/fixtures/scopes/clojure/ifStatement.scope +++ b/data/fixtures/scopes/clojure/ifStatement.scope @@ -1,41 +1,15 @@ (if true aaa - (if false - bbb - ccc)) + bbb) --- -[#1 Content] = -[#1 Removal] = -[#1 Domain] = 0:0-4:13 +[Content] = +[Removal] = +[Domain] = 0:0-2:8 >-------- 0| (if true 1| aaa -2| (if false -3| bbb -4| ccc)) - -------------< +2| bbb) + --------< -[#1 Insertion delimiter] = "\n" - - -[#2 Content] = -[#2 Domain] = 2:4-4:12 - >--------- -2| (if false -3| bbb -4| ccc)) - ------------< - -[#2 Removal] = 2:0-4:12 - >------------- -2| (if false -3| bbb -4| ccc)) - ------------< - -[#2 Leading delimiter] = 2:0-2:4 - >----< -2| (if false - -[#2 Insertion delimiter] = "\n" +[Insertion delimiter] = "\n" diff --git a/data/fixtures/scopes/clojure/name/name.function.scope b/data/fixtures/scopes/clojure/name/name.function.scope new file mode 100644 index 0000000000..8522014053 --- /dev/null +++ b/data/fixtures/scopes/clojure/name/name.function.scope @@ -0,0 +1,24 @@ +(defn foo [] 0) +--- + +[Content] = 0:6-0:9 + >---< +0| (defn foo [] 0) + +[Removal] = 0:6-0:10 + >----< +0| (defn foo [] 0) + +[Leading delimiter] = 0:5-0:6 + >-< +0| (defn foo [] 0) + +[Trailing delimiter] = 0:9-0:10 + >-< +0| (defn foo [] 0) + +[Domain] = 0:0-0:15 + >---------------< +0| (defn foo [] 0) + +[Insertion delimiter] = " " diff --git a/packages/common/src/scopeSupportFacets/clojure.ts b/packages/common/src/scopeSupportFacets/clojure.ts index f23e440aba..18e74a5ef1 100644 --- a/packages/common/src/scopeSupportFacets/clojure.ts +++ b/packages/common/src/scopeSupportFacets/clojure.ts @@ -46,9 +46,6 @@ export const clojureScopeSupport: LanguageScopeSupportFacetMap = { "name.argument.formal.iteration": supported, "name.argument.formal.lambda": supported, "name.argument.formal.lambda.iteration": supported, - "interior.function": supported, - "interior.lambda": supported, - "interior.if": supported, /* NOT APPLICABLE */ @@ -315,6 +312,11 @@ export const clojureScopeSupport: LanguageScopeSupportFacetMap = { "collectionItem.unenclosed.multiLine": notApplicable, "collectionItem.unenclosed.iteration": notApplicable, + // Interior + "interior.function": notApplicable, + "interior.lambda": notApplicable, + "interior.if": notApplicable, + // Miscellaneous statements "statement.misc": notApplicable, "statement.break": notApplicable, diff --git a/queries/clojure.scm b/queries/clojure.scm index b6f6e9aa8a..8f2b82d6bc 100644 --- a/queries/clojure.scm +++ b/queries/clojure.scm @@ -167,17 +167,34 @@ ;;!! (if true "hello") ;;! ^^^^^^^^^^^^^^^^^ ;;! ^^^^ +;;! ^^^^^^ ( (list_lit . value: (_) @_dummy . value: (_) @condition - ) @ifStatement @condition.domain + . + value: (_) @branch + ) @ifStatement @condition.domain @branch.iteration (#text? @_dummy "if" "if-let" "when" "when-let") (#not-parent-type? @ifStatement quoting_lit) ) +;;!! (if true "hello" "world") +;;! ^^^^^^^ +( + (list_lit + . + value: (_) @_dummy + value: (_) @branch + . + ) @_dummyif + (#text? @_dummy "if" "if-let" "when" "when-let") + (#not-parent-type? @_dummyif quoting_lit) + (#is-nth-child? @branch 4) +) + ;;!! {:foo 1, :bar 2} ;;! ^^^^ ^^^^ ;;! ^ ^ From aeae9232325e84541aac398681cb905ff1ea7e93 Mon Sep 17 00:00:00 2001 From: Andreas Arvidsson Date: Sat, 28 Feb 2026 10:10:54 +0100 Subject: [PATCH 3/8] argument list --- .../clojure/argument.actual.iteration.scope | 10 +++++ .../clojure/argument.actual.multiLine.scope | 37 +++++++++++++++++++ .../clojure/argument.actual.singleLine.scope | 37 +++++++++++++++++++ .../clojure/argumentList.actual.empty.scope | 13 +++++++ .../argumentList.actual.multiLine.scope | 21 +++++++++++ .../argumentList.actual.singleLine.scope | 13 +++++++ .../clojure/{branch => }/branch.if.else.scope | 0 .../{branch => }/branch.if.iteration.scope | 0 .../clojure/{branch => }/branch.if.scope | 0 .../clojure/{name => }/name.function.scope | 0 .../common/src/scopeSupportFacets/clojure.ts | 23 +++++++----- queries/clojure.scm | 23 +++++++++--- 12 files changed, 162 insertions(+), 15 deletions(-) create mode 100644 data/fixtures/scopes/clojure/argument.actual.iteration.scope create mode 100644 data/fixtures/scopes/clojure/argument.actual.multiLine.scope create mode 100644 data/fixtures/scopes/clojure/argument.actual.singleLine.scope create mode 100644 data/fixtures/scopes/clojure/argumentList.actual.empty.scope create mode 100644 data/fixtures/scopes/clojure/argumentList.actual.multiLine.scope create mode 100644 data/fixtures/scopes/clojure/argumentList.actual.singleLine.scope rename data/fixtures/scopes/clojure/{branch => }/branch.if.else.scope (100%) rename data/fixtures/scopes/clojure/{branch => }/branch.if.iteration.scope (100%) rename data/fixtures/scopes/clojure/{branch => }/branch.if.scope (100%) rename data/fixtures/scopes/clojure/{name => }/name.function.scope (100%) diff --git a/data/fixtures/scopes/clojure/argument.actual.iteration.scope b/data/fixtures/scopes/clojure/argument.actual.iteration.scope new file mode 100644 index 0000000000..f92f5d03c9 --- /dev/null +++ b/data/fixtures/scopes/clojure/argument.actual.iteration.scope @@ -0,0 +1,10 @@ +(foo aaa bbb) +--- + +[Content] = 0:1-0:12 + >-----------< +0| (foo aaa bbb) + +[Domain] = 0:0-0:13 + >-------------< +0| (foo aaa bbb) diff --git a/data/fixtures/scopes/clojure/argument.actual.multiLine.scope b/data/fixtures/scopes/clojure/argument.actual.multiLine.scope new file mode 100644 index 0000000000..806e7957fb --- /dev/null +++ b/data/fixtures/scopes/clojure/argument.actual.multiLine.scope @@ -0,0 +1,37 @@ +(foo + aaa + bbb) +--- + +[#1 Content] = +[#1 Domain] = 1:4-1:7 + >---< +1| aaa + +[#1 Removal] = 1:0-2:0 + >------- +1| aaa +2| bbb) + < + +[#1 Leading delimiter] = 1:0-1:4 + >----< +1| aaa + +[#1 Insertion delimiter] = "\n" + + +[#2 Content] = +[#2 Domain] = 2:4-2:7 + >---< +2| bbb) + +[#2 Removal] = 2:0-2:7 + >-------< +2| bbb) + +[#2 Leading delimiter] = 2:0-2:4 + >----< +2| bbb) + +[#2 Insertion delimiter] = "\n" diff --git a/data/fixtures/scopes/clojure/argument.actual.singleLine.scope b/data/fixtures/scopes/clojure/argument.actual.singleLine.scope new file mode 100644 index 0000000000..1828f4ba35 --- /dev/null +++ b/data/fixtures/scopes/clojure/argument.actual.singleLine.scope @@ -0,0 +1,37 @@ +(foo aaa bbb) +--- + +[#1 Content] = +[#1 Domain] = 0:5-0:8 + >---< +0| (foo aaa bbb) + +[#1 Removal] = 0:5-0:9 + >----< +0| (foo aaa bbb) + +[#1 Leading delimiter] = 0:4-0:5 + >-< +0| (foo aaa bbb) + +[#1 Trailing delimiter] = 0:8-0:9 + >-< +0| (foo aaa bbb) + +[#1 Insertion delimiter] = " " + + +[#2 Content] = +[#2 Domain] = 0:9-0:12 + >---< +0| (foo aaa bbb) + +[#2 Removal] = 0:8-0:12 + >----< +0| (foo aaa bbb) + +[#2 Leading delimiter] = 0:8-0:9 + >-< +0| (foo aaa bbb) + +[#2 Insertion delimiter] = " " diff --git a/data/fixtures/scopes/clojure/argumentList.actual.empty.scope b/data/fixtures/scopes/clojure/argumentList.actual.empty.scope new file mode 100644 index 0000000000..79c03b287e --- /dev/null +++ b/data/fixtures/scopes/clojure/argumentList.actual.empty.scope @@ -0,0 +1,13 @@ +() +--- + +[Content] = +[Removal] = 0:1-0:1 + >< +0| () + +[Domain] = 0:0-0:2 + >--< +0| () + +[Insertion delimiter] = "" diff --git a/data/fixtures/scopes/clojure/argumentList.actual.multiLine.scope b/data/fixtures/scopes/clojure/argumentList.actual.multiLine.scope new file mode 100644 index 0000000000..9ff346343f --- /dev/null +++ b/data/fixtures/scopes/clojure/argumentList.actual.multiLine.scope @@ -0,0 +1,21 @@ +(foo + aaa + bbb) +--- + +[Content] = +[Removal] = 0:1-2:7 + >--- +0| (foo +1| aaa +2| bbb) + -------< + +[Domain] = 0:0-2:8 + >---- +0| (foo +1| aaa +2| bbb) + --------< + +[Insertion delimiter] = "\n" diff --git a/data/fixtures/scopes/clojure/argumentList.actual.singleLine.scope b/data/fixtures/scopes/clojure/argumentList.actual.singleLine.scope new file mode 100644 index 0000000000..61b444a507 --- /dev/null +++ b/data/fixtures/scopes/clojure/argumentList.actual.singleLine.scope @@ -0,0 +1,13 @@ +(foo aaa bbb) +--- + +[Content] = +[Removal] = 0:1-0:12 + >-----------< +0| (foo aaa bbb) + +[Domain] = 0:0-0:13 + >-------------< +0| (foo aaa bbb) + +[Insertion delimiter] = " " diff --git a/data/fixtures/scopes/clojure/branch/branch.if.else.scope b/data/fixtures/scopes/clojure/branch.if.else.scope similarity index 100% rename from data/fixtures/scopes/clojure/branch/branch.if.else.scope rename to data/fixtures/scopes/clojure/branch.if.else.scope diff --git a/data/fixtures/scopes/clojure/branch/branch.if.iteration.scope b/data/fixtures/scopes/clojure/branch.if.iteration.scope similarity index 100% rename from data/fixtures/scopes/clojure/branch/branch.if.iteration.scope rename to data/fixtures/scopes/clojure/branch.if.iteration.scope diff --git a/data/fixtures/scopes/clojure/branch/branch.if.scope b/data/fixtures/scopes/clojure/branch.if.scope similarity index 100% rename from data/fixtures/scopes/clojure/branch/branch.if.scope rename to data/fixtures/scopes/clojure/branch.if.scope diff --git a/data/fixtures/scopes/clojure/name/name.function.scope b/data/fixtures/scopes/clojure/name.function.scope similarity index 100% rename from data/fixtures/scopes/clojure/name/name.function.scope rename to data/fixtures/scopes/clojure/name.function.scope diff --git a/packages/common/src/scopeSupportFacets/clojure.ts b/packages/common/src/scopeSupportFacets/clojure.ts index 18e74a5ef1..89b957cf9c 100644 --- a/packages/common/src/scopeSupportFacets/clojure.ts +++ b/packages/common/src/scopeSupportFacets/clojure.ts @@ -16,12 +16,7 @@ export const clojureScopeSupport: LanguageScopeSupportFacetMap = { "argument.actual.singleLine": supported, "argument.actual.multiLine": supported, "argument.actual.iteration": supported, - "argument.formal.singleLine": supported, - "argument.formal.multiLine": supported, - "argument.formal.iteration": supported, - "argument.formal.lambda.singleLine": supported, - "argument.formal.lambda.multiLine": supported, - "argument.formal.lambda.iteration": supported, + "argumentList.actual.empty": supported, "argumentList.actual.singleLine": supported, "argumentList.actual.multiLine": supported, @@ -42,13 +37,21 @@ export const clojureScopeSupport: LanguageScopeSupportFacetMap = { "textFragment.string.singleLine": supported, "textFragment.string.multiLine": supported, "name.function": supported, - "name.argument.formal": supported, - "name.argument.formal.iteration": supported, - "name.argument.formal.lambda": supported, - "name.argument.formal.lambda.iteration": supported, /* NOT APPLICABLE */ + // In Clojure every function definition is also a function call + "argument.formal.singleLine": notApplicable, + "argument.formal.multiLine": notApplicable, + "argument.formal.iteration": notApplicable, + "argument.formal.lambda.singleLine": notApplicable, + "argument.formal.lambda.multiLine": notApplicable, + "argument.formal.lambda.iteration": notApplicable, + "name.argument.formal": notApplicable, + "name.argument.formal.iteration": notApplicable, + "name.argument.formal.lambda": notApplicable, + "name.argument.formal.lambda.iteration": notApplicable, + // Assignment "statement.assignment": notApplicable, "statement.assignment.compound": notApplicable, diff --git a/queries/clojure.scm b/queries/clojure.scm index 8f2b82d6bc..b8eef8320d 100644 --- a/queries/clojure.scm +++ b/queries/clojure.scm @@ -104,8 +104,8 @@ _ @_dummy . value: (_) @collectionItem - (#not-type? @_dummy "kwd_lit") - (#not-type? @collectionItem "kwd_lit") + (#not-type? @_dummy kwd_lit) + (#not-type? @collectionItem kwd_lit) ) (map_lit @@ -119,13 +119,25 @@ (list_lit . value: (_) @functionCallee - ) @functionCall @functionCallee.domain @argumentOrParameter.iteration + ) @functionCall @functionCallee.domain ;; A function call is a list literal which is not quoted (#not-parent-type? @functionCall quoting_lit) ) -;;!! (foo :bar) -;;! ^^^^ +;;!! (foo) +;;! ^^^ +( + (list_lit + "(" @argumentOrParameter.iteration.start.endOf + ")" @argumentOrParameter.iteration.end.startOf + ) @argumentList @argumentList.domain @argumentOrParameter.iteration.domain + (#not-parent-type? @argumentList quoting_lit) + (#empty-single-multi-delimiter! @argumentList @argumentList "" " " "\n") + (#child-range! @argumentList 1 -2) +) + +;;!! (foo aaa bbb) +;;! ^^^ ^^^ ( (list_lit . @@ -133,6 +145,7 @@ value: (_) @argumentOrParameter ) @_dummy (#not-parent-type? @_dummy quoting_lit) + (#single-or-multi-line-delimiter! @argumentOrParameter @_dummy " " "\n") ) ;;!! (defn foo [] 5) From c2d183ec8a8f726beb529eb98267531bbb8b2f74 Mon Sep 17 00:00:00 2001 From: Andreas Arvidsson Date: Sat, 28 Feb 2026 10:12:51 +0100 Subject: [PATCH 4/8] sort --- .../common/src/scopeSupportFacets/clojure.ts | 26 ++++++++++++------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/packages/common/src/scopeSupportFacets/clojure.ts b/packages/common/src/scopeSupportFacets/clojure.ts index 89b957cf9c..08f717f451 100644 --- a/packages/common/src/scopeSupportFacets/clojure.ts +++ b/packages/common/src/scopeSupportFacets/clojure.ts @@ -8,11 +8,17 @@ export const clojureScopeSupport: LanguageScopeSupportFacetMap = { list: supported, map: supported, ifStatement: supported, + "condition.if": supported, + "comment.line": supported, + "name.function": supported, + anonymousFunction: supported, + namedFunction: supported, "namedFunction.iteration.document": supported, - anonymousFunction: supported, + functionCall: supported, functionCallee: supported, + "argument.actual.singleLine": supported, "argument.actual.multiLine": supported, "argument.actual.iteration": supported, @@ -20,23 +26,17 @@ export const clojureScopeSupport: LanguageScopeSupportFacetMap = { "argumentList.actual.empty": supported, "argumentList.actual.singleLine": supported, "argumentList.actual.multiLine": supported, - "argumentList.formal.empty": supported, - "argumentList.formal.singleLine": supported, - "argumentList.formal.multiLine": supported, - "argumentList.formal.lambda.empty": supported, - "argumentList.formal.lambda.singleLine": supported, - "argumentList.formal.lambda.multiLine": supported, + "branch.if": supported, "branch.if.else": supported, "branch.if.iteration": supported, - "condition.if": supported, - "comment.line": supported, + "string.singleLine": supported, "string.multiLine": supported, + "textFragment.comment.line": supported, "textFragment.string.singleLine": supported, "textFragment.string.multiLine": supported, - "name.function": supported, /* NOT APPLICABLE */ @@ -51,6 +51,12 @@ export const clojureScopeSupport: LanguageScopeSupportFacetMap = { "name.argument.formal.iteration": notApplicable, "name.argument.formal.lambda": notApplicable, "name.argument.formal.lambda.iteration": notApplicable, + "argumentList.formal.empty": notApplicable, + "argumentList.formal.singleLine": notApplicable, + "argumentList.formal.multiLine": notApplicable, + "argumentList.formal.lambda.empty": notApplicable, + "argumentList.formal.lambda.singleLine": notApplicable, + "argumentList.formal.lambda.multiLine": notApplicable, // Assignment "statement.assignment": notApplicable, From a33c301cc0554e0e1204e40ae1886129e6fe47fe Mon Sep 17 00:00:00 2001 From: Andreas Arvidsson Date: Sat, 28 Feb 2026 10:17:33 +0100 Subject: [PATCH 5/8] Added missing --- packages/common/src/scopeSupportFacets/clojure.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/packages/common/src/scopeSupportFacets/clojure.ts b/packages/common/src/scopeSupportFacets/clojure.ts index 08f717f451..fc7424ac74 100644 --- a/packages/common/src/scopeSupportFacets/clojure.ts +++ b/packages/common/src/scopeSupportFacets/clojure.ts @@ -40,7 +40,8 @@ export const clojureScopeSupport: LanguageScopeSupportFacetMap = { /* NOT APPLICABLE */ - // In Clojure every function definition is also a function call + // In Clojure every function definition is also a function call. + // Defining formal arguments therefore became problematic. "argument.formal.singleLine": notApplicable, "argument.formal.multiLine": notApplicable, "argument.formal.iteration": notApplicable, @@ -51,6 +52,8 @@ export const clojureScopeSupport: LanguageScopeSupportFacetMap = { "name.argument.formal.iteration": notApplicable, "name.argument.formal.lambda": notApplicable, "name.argument.formal.lambda.iteration": notApplicable, + "value.argument.formal.lambda": notApplicable, + "value.argument.formal.lambda.iteration": notApplicable, "argumentList.formal.empty": notApplicable, "argumentList.formal.singleLine": notApplicable, "argumentList.formal.multiLine": notApplicable, @@ -326,6 +329,10 @@ export const clojureScopeSupport: LanguageScopeSupportFacetMap = { "interior.lambda": notApplicable, "interior.if": notApplicable, + // Block comments + "comment.block": notApplicable, + "textFragment.comment.block": notApplicable, + // Miscellaneous statements "statement.misc": notApplicable, "statement.break": notApplicable, @@ -336,7 +343,6 @@ export const clojureScopeSupport: LanguageScopeSupportFacetMap = { "statement.iteration.block": notApplicable, // Miscellaneous - "comment.block": notApplicable, environment: notApplicable, fieldAccess: notApplicable, "key.mapPair": notApplicable, From 0de73b0310dda9fdfe054bdd669705b37d2381b6 Mon Sep 17 00:00:00 2001 From: Andreas Arvidsson Date: Sat, 28 Feb 2026 10:22:27 +0100 Subject: [PATCH 6/8] if branch fix --- queries/clojure.scm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/queries/clojure.scm b/queries/clojure.scm index b8eef8320d..79999bcd7b 100644 --- a/queries/clojure.scm +++ b/queries/clojure.scm @@ -203,7 +203,7 @@ value: (_) @branch . ) @_dummyif - (#text? @_dummy "if" "if-let" "when" "when-let") + (#text? @_dummy "if" "if-let") (#not-parent-type? @_dummyif quoting_lit) (#is-nth-child? @branch 4) ) From 2141fc905075bf325042f14f7496456399345c49 Mon Sep 17 00:00:00 2001 From: Andreas Arvidsson Date: Sat, 28 Feb 2026 10:25:49 +0100 Subject: [PATCH 7/8] remove branch --- .../scopes/clojure/branch.if.else.scope | 37 ------------------- .../scopes/clojure/branch.if.iteration.scope | 12 ------ data/fixtures/scopes/clojure/branch.if.scope | 18 --------- .../common/src/scopeSupportFacets/clojure.ts | 7 ++-- queries/clojure.scm | 18 +-------- 5 files changed, 4 insertions(+), 88 deletions(-) delete mode 100644 data/fixtures/scopes/clojure/branch.if.else.scope delete mode 100644 data/fixtures/scopes/clojure/branch.if.iteration.scope delete mode 100644 data/fixtures/scopes/clojure/branch.if.scope diff --git a/data/fixtures/scopes/clojure/branch.if.else.scope b/data/fixtures/scopes/clojure/branch.if.else.scope deleted file mode 100644 index 2d575933f6..0000000000 --- a/data/fixtures/scopes/clojure/branch.if.else.scope +++ /dev/null @@ -1,37 +0,0 @@ -(if true - aaa - bbb) ---- - -[#1 Content] = -[#1 Domain] = 1:4-1:7 - >---< -1| aaa - -[#1 Removal] = 1:0-2:0 - >------- -1| aaa -2| bbb) - < - -[#1 Leading delimiter] = 1:0-1:4 - >----< -1| aaa - -[#1 Insertion delimiter] = "\n" - - -[#2 Content] = -[#2 Domain] = 2:4-2:7 - >---< -2| bbb) - -[#2 Removal] = 2:0-2:7 - >-------< -2| bbb) - -[#2 Leading delimiter] = 2:0-2:4 - >----< -2| bbb) - -[#2 Insertion delimiter] = "\n" diff --git a/data/fixtures/scopes/clojure/branch.if.iteration.scope b/data/fixtures/scopes/clojure/branch.if.iteration.scope deleted file mode 100644 index c70aed374e..0000000000 --- a/data/fixtures/scopes/clojure/branch.if.iteration.scope +++ /dev/null @@ -1,12 +0,0 @@ -(if true - aaa - bbb) ---- - -[Content] = -[Domain] = 0:0-2:8 - >-------- -0| (if true -1| aaa -2| bbb) - --------< diff --git a/data/fixtures/scopes/clojure/branch.if.scope b/data/fixtures/scopes/clojure/branch.if.scope deleted file mode 100644 index 0334b3289c..0000000000 --- a/data/fixtures/scopes/clojure/branch.if.scope +++ /dev/null @@ -1,18 +0,0 @@ -(if true - aaa) ---- - -[Content] = -[Domain] = 1:4-1:7 - >---< -1| aaa) - -[Removal] = 1:0-1:7 - >-------< -1| aaa) - -[Leading delimiter] = 1:0-1:4 - >----< -1| aaa) - -[Insertion delimiter] = "\n" diff --git a/packages/common/src/scopeSupportFacets/clojure.ts b/packages/common/src/scopeSupportFacets/clojure.ts index fc7424ac74..c557d6ed59 100644 --- a/packages/common/src/scopeSupportFacets/clojure.ts +++ b/packages/common/src/scopeSupportFacets/clojure.ts @@ -27,10 +27,6 @@ export const clojureScopeSupport: LanguageScopeSupportFacetMap = { "argumentList.actual.singleLine": supported, "argumentList.actual.multiLine": supported, - "branch.if": supported, - "branch.if.else": supported, - "branch.if.iteration": supported, - "string.singleLine": supported, "string.multiLine": supported, @@ -233,6 +229,9 @@ export const clojureScopeSupport: LanguageScopeSupportFacetMap = { // If statement "statement.if": notApplicable, "branch.if.elif.else": notApplicable, + "branch.if": notApplicable, + "branch.if.else": notApplicable, + "branch.if.iteration": notApplicable, // Switch statement "statement.switch": notApplicable, diff --git a/queries/clojure.scm b/queries/clojure.scm index 79999bcd7b..8ab8adf9de 100644 --- a/queries/clojure.scm +++ b/queries/clojure.scm @@ -187,27 +187,11 @@ value: (_) @_dummy . value: (_) @condition - . - value: (_) @branch - ) @ifStatement @condition.domain @branch.iteration + ) @ifStatement @condition.domain (#text? @_dummy "if" "if-let" "when" "when-let") (#not-parent-type? @ifStatement quoting_lit) ) -;;!! (if true "hello" "world") -;;! ^^^^^^^ -( - (list_lit - . - value: (_) @_dummy - value: (_) @branch - . - ) @_dummyif - (#text? @_dummy "if" "if-let") - (#not-parent-type? @_dummyif quoting_lit) - (#is-nth-child? @branch 4) -) - ;;!! {:foo 1, :bar 2} ;;! ^^^^ ^^^^ ;;! ^ ^ From 3d6a4bcf8abe08bd1819d3fd00c123bc903f7970 Mon Sep 17 00:00:00 2001 From: Andreas Arvidsson Date: Sat, 28 Feb 2026 10:30:31 +0100 Subject: [PATCH 8/8] update comments --- queries/clojure.scm | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/queries/clojure.scm b/queries/clojure.scm index 8ab8adf9de..c844805c6b 100644 --- a/queries/clojure.scm +++ b/queries/clojure.scm @@ -113,8 +113,9 @@ close: "}" @collectionItem.iteration.end.startOf ) @collectionItem.iteration.domain -;;!! (foo) -;;! ^^^^^ +;;!! (foo aaa bbb) +;;! ^^^^^^^^^^^^^ +;;! ^^^ ( (list_lit . @@ -180,7 +181,6 @@ ;;!! (if true "hello") ;;! ^^^^^^^^^^^^^^^^^ ;;! ^^^^ -;;! ^^^^^^ ( (list_lit .