-
-
Notifications
You must be signed in to change notification settings - Fork 89
initial nix language support #1911
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
fidgetingbits
wants to merge
20
commits into
cursorless-dev:main
Choose a base branch
from
fidgetingbits:nix-lang
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+2,367
β0
Draft
Changes from 4 commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
1db5b69
initial nix language support
16f9ff3
Fix callee and args, and add inherit keyword specialc ase
85e0775
Fix branch test now that we match ts behavior
7c5e12a
Add inside support for maps and lists
e3a1480
Add branch interior
7472aab
Disable statements most places, add item for maps, fix list error
7199519
editorconfing lint and a bit of removals
68638f4
Fix call/callee in a bunch of cases
c3d1ae7
Support inside comment
7abb7a3
Support other variation of @ assignment for args
2e217be
Fix mixing functionCall case
250a68b
assert tests and other tweaks
5b4cc8d
Remove inside comment stuff for now
db69df5
add collectionItem iteration and domain to lists
4c517d7
Merge branch 'main' into pr/fidgetingbits/1911
pokey a6d6b58
Merge branch 'main' into nix-lang
pokey d0844e6
Merge remote-tracking branch 'upstream/main' into nix-lang
fidgetingbits bf7df7e
[pre-commit.ci lite] apply automatic fixes
pre-commit-ci-lite[bot] f402bd4
fix merge screwup
fidgetingbits 43f72e7
Merge remote-tracking branch 'upstream/main' into nix-lang
fidgetingbits File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# https://nixos.org/manual/nix/stable/language/constructs.html#assertions | ||
|
||
{ localServer ? false | ||
, httpServer ? false | ||
, sslSupport ? false | ||
, pythonBindings ? false | ||
, javaSwigBindings ? false | ||
, javahlBindings ? false | ||
, stdenv, fetchurl | ||
, openssl ? null, httpd ? null, db4 ? null, expat, swig ? null, j2sdk ? null | ||
}: | ||
|
||
assert localerver -> db4 != null; | ||
assert httpServer -> httpd != null && httpd.expat == expat; | ||
assert sslSupport -> openssl != null && (httpServer -> httpd.openssl == openssl); | ||
assert pythonBindings -> swig != null && swig.pythonSupport; | ||
assert javaSwigBindings -> swig != null && swig.javaSupport; | ||
assert javahlBindings -> j2sdk != null; | ||
|
||
stdenv.mkDerivation { | ||
(name = "subversion-1.1.1";) | ||
... | ||
openssl = if sslSupport then openssl else null; | ||
... | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{ | ||
a = { a = b; c = d; }; | ||
a = { | ||
a = b; | ||
c = d; | ||
}; | ||
|
||
a = { | ||
a = { | ||
b = 1; }; | ||
|
||
c = { d = [ "1" 2 ] }; | ||
}; | ||
|
||
a = rec { | ||
a = b; | ||
b = a + 1; | ||
}; | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# Single-line comment | ||
/* | ||
Multi-line comment | ||
*/ | ||
{ | ||
a = b; # Inline comment (test) | ||
b = c; # Inline comment 2 | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
{ | ||
inputs = { | ||
nixpkgs.url = "github:nixos/nixpkgs/nixos-23.05"; | ||
home-manager = { | ||
url = "github:nix-community/home-manager/release-23.05"; | ||
inputs.nixpkgs.follows = "nixpkgs"; | ||
}; | ||
}; | ||
|
||
outputs = { self, nixpkgs, home-manager }: | ||
let | ||
mkHost = hostName: system: | ||
(({ my-config, zfs-root, pkgs, system, ... }: | ||
nixpkgs.lib.nixosSystem { | ||
inherit system; | ||
modules = [ | ||
# Module 0: zfs-root and my-config | ||
./modules | ||
|
||
# Module 1: host-specific config, if exist | ||
(if (builtins.pathExists | ||
./hosts/${hostName}/configuration.nix) then | ||
(import ./hosts/${hostName}/configuration.nix { inherit pkgs; }) | ||
else | ||
{ }) | ||
|
||
# Module 2: entry point | ||
(({ my-config, zfs-root, pkgs, lib, ... }: { | ||
inherit my-config zfs-root; | ||
system.configurationRevision = if (self ? rev) then | ||
self.rev | ||
else | ||
throw "refuse to build: git tree is dirty"; | ||
system.stateVersion = "23.05"; | ||
imports = [ | ||
"${nixpkgs}/nixos/modules/installer/scan/not-detected.nix" | ||
# "${nixpkgs}/nixos/modules/profiles/hardened.nix" | ||
# "${nixpkgs}/nixos/modules/profiles/qemu-guest.nix" | ||
]; | ||
}) { | ||
inherit my-config zfs-root pkgs; | ||
lib = nixpkgs.lib; | ||
}) | ||
|
||
# Module 3: home-manager | ||
home-manager.nixosModules.home-manager | ||
{ | ||
home-manager.useGlobalPkgs = true; | ||
home-manager.useUserPackages = true; | ||
} | ||
|
||
# Module 4: config shared by all hosts | ||
(import ./configuration.nix { inherit pkgs; }) | ||
]; | ||
}) | ||
|
||
# configuration input | ||
(import ./hosts/${hostName} { | ||
system = system; | ||
pkgs = nixpkgs.legacyPackages.${system}; | ||
})); | ||
in { | ||
nixosConfigurations = { | ||
exampleHost = mkHost "exampleHost" "x86_64-linux"; | ||
}; | ||
}; | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
# Anonymous function | ||
a = foo: (foo + 1); | ||
x = a: b: a + b; | ||
|
||
# Non-built-in function | ||
ba = test( foo: bar: { | ||
b = foo; | ||
}); | ||
|
||
# Built-in function | ||
x = map (x: y: x + x) [ 1 2 3 ]; | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
foo = [ "a" a/b/c "b" ]; | ||
bar = [ A | ||
B | ||
C # foo | ||
]; | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
{ | ||
key = if a then b else c; | ||
key = | ||
if a | ||
then b | ||
else c; | ||
|
||
a = b; # Inline comment (test) | ||
b = c; # Inline comment 2 | ||
a = 1 + 1; | ||
a = a/b/c ? 0; | ||
a = b: b + 1; | ||
|
||
foo = let | ||
a = b; | ||
c = d; | ||
in | ||
{ | ||
output = b; | ||
}; | ||
|
||
bar = let | ||
a = 1; | ||
b = 2; | ||
in a + b; | ||
|
||
bar = | ||
with key; | ||
let | ||
a = key; | ||
in | ||
a; | ||
|
||
a = x: x + 1; | ||
b = x: y: x + y + 1; | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
a = "double quoted string"; | ||
b = ''two single quote string''; | ||
c = '' | ||
multi-line | ||
quote string''; | ||
d = "Interpolated ${value} string"; | ||
e = "Escaped \${string} "; | ||
f = '' | ||
"Nested" | ||
string | ||
''; | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/nix/changeArg.yml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
languageId: nix | ||
command: | ||
version: 6 | ||
spokenForm: change arg | ||
action: | ||
name: clearAndSetSelection | ||
target: | ||
type: primitive | ||
modifiers: | ||
- type: containingScope | ||
scopeType: {type: argumentOrParameter} | ||
usePrePhraseSnapshot: true | ||
initialState: | ||
documentContents: |- | ||
{ pkgs, ... }: | ||
{ a = 1; } | ||
selections: | ||
- anchor: {line: 0, character: 10} | ||
active: {line: 0, character: 10} | ||
marks: {} | ||
finalState: | ||
documentContents: |- | ||
: | ||
{ a = 1; } | ||
selections: | ||
- anchor: {line: 0, character: 0} | ||
active: {line: 0, character: 0} |
27 changes: 27 additions & 0 deletions
27
packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/nix/changeArg2.yml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
languageId: nix | ||
command: | ||
version: 6 | ||
spokenForm: change arg | ||
action: | ||
name: clearAndSetSelection | ||
target: | ||
type: primitive | ||
modifiers: | ||
- type: containingScope | ||
scopeType: {type: argumentOrParameter} | ||
usePrePhraseSnapshot: true | ||
initialState: | ||
documentContents: |- | ||
{ pkgs, ... }: | ||
{ a = 1; } | ||
selections: | ||
- anchor: {line: 1, character: 4} | ||
active: {line: 1, character: 4} | ||
marks: {} | ||
finalState: | ||
documentContents: |- | ||
: | ||
{ a = 1; } | ||
selections: | ||
- anchor: {line: 0, character: 0} | ||
active: {line: 0, character: 0} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.