Skip to content

initial nix language support#1911

Draft
fidgetingbits wants to merge 20 commits intocursorless-dev:mainfrom
fidgetingbits:nix-lang
Draft

initial nix language support#1911
fidgetingbits wants to merge 20 commits intocursorless-dev:mainfrom
fidgetingbits:nix-lang

Conversation

@fidgetingbits
Copy link
Collaborator

@fidgetingbits fidgetingbits commented Sep 24, 2023

EDIT: I removed the original PR text, as no longer relevant and will have made it harder to review.

This PR adds nix language support.

Checklist

  • Recorded tests for the new language
  • Used "change" / "clear" instead of "take" for selection tests to make recorded tests easier to read
  • Added a few specific tests that use "chuck" instead of "change" to test removal behaviour when it's interesting, especially:
    • "chuck arg" with single argument in list
    • "chuck arg" with multiple arguments in list
    • "chuck item" with single argument in list
    • "chuck item" with multiple arguments in list
  • Added @textFragment captures. Usually you want to put these on comment and string nodes. This enables "take round" to work within comments and strings.
  • Added a test for "change round" inside a string, eg "hello (there)"
  • [-] Supported "type" both for type annotations (eg foo: string) and declarations (eg interface Foo {}) (and added tests for this behaviour 😊)
  • Supported "item" both for map pairs and list entries (with tests of course)
Supported Tested Term Capture Definition Comment
list @list List type equivalent -
inside list @list.interior Inside of a list -
map @map Dictionary type equivalent -
inside map @map.interior Inside of a dictionary -
key @collectionKey Dictionary key equivalent -
funk @namedFunction A named function declaration -
inside funk @namedFunction.interior The inside of a lambda declaration -
funk name @functionName Name of declared function -
lambda @anonymousFunction A lambda declaration -
inside lambda @anonymousFunction.interior The inside of a lambda declaration -
name @name Variable name -
value @value Right-hand-side value of an assignment -
_ _ value @value Value returned from a function -
value @value Value of a key-value pair -
state @statement Any single coded statement -
if state @ifStatement An if conditional block -
condition @condition Condition of an if block -
_ _ condition @condition Condition of a while loop -
_ _ condition @condition Condition of a do while style loop -
_ _ condition @condition Condition of a for loop -
_ _ condition @condition Condition of a ternary expression -
branch @branch The resulting code associated with a conditional expression -
inside branch @branch.interior The statements associated with the body of a conditional expression -
comment @comment Single line code comment -
comment @comment Multi-line code comment -
string @string Single line strings -
string @string Multi-line strings -
- @textFragment Used to capture string-type nodes (strings and comments) -
call @functionCall A function call (not a function definition) -
callee @functionCallee Name of the function being called -
arg @argumentOrParameter Arguments to function definition -
arg @argumentOrParameter Arguments to function calls -
arg @argumentOrParameter Interpolated variables in strings -
_ _ class @class Class or structure declaration -
_ _ inside class @class.interior The inside of a class declaration -
_ _ class name @className Name of class or structure declaration -
_ _ type @type Type declarations -

Checklist

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants