1
1
mirror of https://github.com/oxalica/nil.git synced 2024-11-28 22:13:50 +03:00
Commit Graph

288 Commits

Author SHA1 Message Date
oxalica
b7bc2636c1 Bump async-lsp and revert "Only enable ClientProcessMonitorLayer for Linux"
This reverts commit 263b82c6d2.
2023-04-19 01:57:08 +08:00
oxalica
263b82c6d2 Only enable ClientProcessMonitorLayer for Linux 2023-04-18 03:36:50 +08:00
oxalica
a22c8d85a4 Warn when non-pipe-like stdin/stdout is used 2023-04-18 03:14:51 +08:00
oxalica
c86e96c003 Use async-lsp from crates.io to fix nix build 2023-04-18 02:55:54 +08:00
oxalica
51da89f1ec Report progress when archiving flake 2023-04-17 11:34:58 +08:00
oxalica
66dc5e7d94 Guard show_message_request with client capabilities 2023-04-17 11:34:58 +08:00
oxalica
5c55e4c6b4 Archive flake when needed 2023-04-17 11:22:21 +08:00
oxalica
ea66982de7 Refactor diagnostics updating 2023-04-17 11:22:21 +08:00
oxalica
0ff186cc42 Refactor config updating event 2023-04-17 11:22:21 +08:00
oxalica
578e2c28d3 Asyncify flake workspace loading task 2023-04-17 11:22:21 +08:00
oxalica
0edd88a682 Switch to async-lsp framework 2023-04-17 11:21:52 +08:00
oxalica
1d5bc81023 Fix typo 2023-04-14 03:06:42 +08:00
oxalica
df541a798d Suppress unused warnings for flake auto-inputs
Fixes #73
2023-04-14 03:04:26 +08:00
oxalica
a55f287f24 Make tests platform-agnostic 2023-04-14 02:36:12 +08:00
oxalica
9995235134 Update dependencies 2023-04-14 02:12:57 +08:00
oxalica
0718fca59b Parse rec attrsets in flake.nix 2023-03-30 22:04:10 +08:00
oxalica
f3eaa77002 Escape invalid identifiers in completions 2023-03-29 16:24:15 +08:00
oxalica
932803b1de Fix panics when flake inputs contain self 2023-03-28 21:44:43 +08:00
oxalica
775ba9e6ac Parse flake outputs and add flake package meta 2023-03-27 00:10:43 +08:00
oxalica
73fda84341 Warn when running language server in terminal 2023-03-24 14:18:35 +08:00
oxalica
431d4540de Split out LSP initialization and return serverInfo 2023-03-24 13:51:26 +08:00
oxalica
6d01eb0ad1 Use poll(2) instead of select(2) 2023-03-24 13:37:09 +08:00
oxalica
48009b60fa Refactor LSP main loop 2023-03-24 13:16:45 +08:00
oxalica
8463c135ad Translate and inject option types from Nix 2023-03-14 01:14:22 +08:00
oxalica
5b99f7aab5 Inject NixOS options 2023-03-13 22:46:45 +08:00
oxalica
9a043a5039 Add NixOS configuration type database input 2023-03-13 17:47:56 +08:00
oxalica
fe38ceaae6 Move string escaping to syntax::semantic and fix 2023-03-13 13:39:44 +08:00
oxalica
2552c08e39 Fix parsing of ' in indented strings 2023-03-11 23:13:46 +08:00
figsoda
e5fcdc168c
Add string rewriting assists (#69) 2023-03-11 23:05:19 +08:00
oxalica
457f6020be Impl subcommand parse 2023-03-11 22:51:43 +08:00
oxalica
7b0b15021e Extract error reporting from diagnostics subcommand 2023-03-11 22:50:28 +08:00
oxalica
09bcbd1ddd Ignore root node itself as flake inputs
This is not perfect but we don't support out-of-store flake inputs yet.

Fixes #71
2023-03-11 09:01:10 +08:00
oxalica
bbca41c5ee Apply clippy::uninlined_format_args 2023-03-10 16:10:09 +08:00
oxalica
4ec9367726 Apply clippy::manual-let-else 2023-03-10 16:10:09 +08:00
oxalica
4a9f128200 Apply clippy::{doc_markdown,missing-panics-doc} 2023-03-10 16:10:02 +08:00
figsoda
d101741884
Implement type inference for rest attributes (#68) 2023-03-09 06:17:13 +08:00
oxalica
b5797b481a Fix unexpected remove from local_file_set 2023-03-09 04:08:45 +08:00
figsoda
267e2b4d73 Briefly document _ attributes 2023-03-08 22:18:41 +08:00
figsoda
4e31fede0a Correct and extend types for nixosConfigurations 2023-03-08 22:18:41 +08:00
figsoda
59ffbac047 Consider system attributes when typing flake outputs 2023-03-08 22:18:41 +08:00
oxalica
fc91c3f6d6 Rename confusing SyntaxKind::is_* 2023-03-07 03:30:52 +08:00
Moritz Böhme
bb9a748cce Add remove_empty_let_in assist 2023-03-05 06:19:17 +08:00
oxalica
0f918f956f Warn unused parameters in flake outputs lambda 2023-03-04 02:30:16 +08:00
oxalica
f40199bea2 Warn unused pat parameters for modules and packages 2023-03-04 02:25:42 +08:00
oxalica
dace5df783 Guess ModuleKind for packages and NixOS modules 2023-03-04 01:37:10 +08:00
oxalica
ba70fc01fd Split out ModuleKind guessing 2023-03-03 22:00:24 +08:00
oxalica
d4e6677846 Export file referrer query as experimental/parentModule
See: https://github.com/microsoft/language-server-protocol/issues/1002
2023-02-18 06:12:56 +08:00
oxalica
87d007b2ab Track referrers of modules 2023-02-17 21:21:51 +08:00
oxalica
ea8ee40bd1 Sweep unused dependencies 2023-02-14 23:54:14 +08:00
oxalica
d62d4a4dd4 Improve query cache efficiency 2023-02-14 23:54:14 +08:00
oxalica
4dd931f460 Enforce clippy::semicolon_if_nothing_returned 2023-02-14 23:54:14 +08:00
oxalica
f5f359d81c Store index of from-expression in InheritFrom
This could hopefully reduces deduplication cost when traversing `Expr`s.
2023-02-14 23:54:14 +08:00
oxalica
ce2e0b5d60 Hoist common cargo settings and use resolver 2 2023-02-11 18:17:58 +08:00
oxalica
a304ab352b Track builtins via AttrSource to show completion docs for builtins.|
See also #15
2023-02-11 04:59:07 +08:00
oxalica
a8c76d2eed Rework Ty formatter and show signatures in completions 2023-02-11 04:30:00 +08:00
oxalica
124b1fd287 Bump lsp_types to 0.94.0 2023-02-11 03:11:19 +08:00
oxalica
f0dd52697c Forbid easy ? in notification handlers
This would abort the server immediately currently (as in #58).
We should gracefully handle these errors instead. Possibly by ignoring
them and clean the states.
2023-02-10 09:34:22 +08:00
oxalica
5179eb45dc Refactor Vfs error handling 2023-02-10 09:34:22 +08:00
oxalica
4dfaf037da Support virtual path URIs (untitled:.*)
Fixes #58
2023-02-10 09:34:22 +08:00
oxalica
5086508235 Use PathBuf in VfsPath to simplify 2023-02-10 09:34:22 +08:00
oxalica
015ecacf43 Rework follows resolution of flake lock
Fixes #56
2023-02-09 01:47:01 +08:00
oxalica
1a15174958 Always set default flake_grpah
Fixes panics in #56
2023-02-04 08:51:12 +08:00
oxalica
bbb71a6c13 Highlight indirect builtins 2023-02-04 08:38:09 +08:00
oxalica
bb632c4219 Recognize builtins from inherit (builtins) 2023-02-04 08:01:01 +08:00
oxalica
727a73722f Special case for hover of builtins.xxx
Fixes #15
2023-02-04 06:59:39 +08:00
oxalica
7ad13dd6fa Tweak hover message and show types of builtins 2023-02-04 06:38:39 +08:00
oxalica
893e5cf204 Type builtins and fix typos in ty! 2023-02-04 05:28:05 +08:00
oxalica
3de72eefd8 Print backtrace and log when panicking 2023-02-03 20:27:35 +08:00
oxalica
232e16ddf0 Support TextDocumentContentChangeEvent with no range
Fixes #53
2023-02-03 20:26:51 +08:00
oxalica
d916585048 Snapshot LineMap during diagnostic calculation
This assumes diagnostics can only reference the local file, which
currently true.
2023-02-03 20:25:34 +08:00
oxalica
b3d65b8bd7 Update docs 2023-02-03 19:07:17 +08:00
oxalica
64da72685d Complete in pat-parameter definitions 2023-02-03 17:58:14 +08:00
oxalica
2d048b7f28 Shrink structs before returning from queries 2023-02-03 03:53:51 +08:00
oxalica
6b2eb7b9eb Update la-arena and add capacity hints 2023-02-03 03:45:17 +08:00
oxalica
97de111137 Fix tests 2023-02-03 03:19:44 +08:00
oxalica
54a5c84cb8 Remove double indirections of Ty::Attrset 2023-02-03 03:09:24 +08:00
oxalica
d044c9c5b4 Inject type schema for flake.nix
Closes #54
2023-02-03 03:09:24 +08:00
oxalica
c003625948 Impl external expected types for type inference 2023-02-03 02:18:31 +08:00
oxalica
e0707ad935 Split result Ty type from Ty in inference context 2023-02-03 00:55:08 +08:00
oxalica
dfd91e3b7e CLI for diagnostics 2023-01-28 23:52:26 +08:00
oxalica
f1c2dbc857 Use argh and simplify version embedding 2023-01-28 22:29:26 +08:00
oxalica
2082551a99 Configurable path to nix binary 2023-01-28 04:32:41 +08:00
oxalica
e797666505 Extract error handling of send_request and simplify 2023-01-28 04:24:07 +08:00
oxalica
7844f61b75 Introduce ModuleKind to parse known file layouts 2023-01-28 01:37:24 +08:00
oxalica
27abf4d61d Warn users about unavailable flake inputs 2023-01-28 01:37:24 +08:00
oxalica
c1352ac4b1 Impl goto-definition for flake inputs 2023-01-28 01:37:24 +08:00
oxalica
1c14e1383a Add flake structure as database input 2023-01-27 16:16:48 +08:00
oxalica
6e55610257 Load locked flake inputs 2023-01-27 03:54:11 +08:00
oxalica
0eb313e73b Impl flake lock parser and wrapper of 'nix eval' 2023-01-27 03:36:20 +08:00
oxalica
9aa5ed132f Extract constants from Nix to a new crate 2023-01-27 03:36:20 +08:00
oxalica
6e5321582c Tweak VfsPath conversion interfaces 2023-01-24 23:13:56 +08:00
oxalica
29fdd1fba9 Use anyhow in the LSP server 2023-01-24 22:42:36 +08:00
oxalica
d9e0468ded Update dependencies 2023-01-19 14:40:02 +08:00
oxalica
07543e5de8 Update rust toolchain to 1.66 2023-01-19 14:40:02 +08:00
oxalica
0eff7fc333 Impl convert_to_inherit for rec bindings 2023-01-02 22:12:02 +08:00
oxalica
cf10fad204 Improve backtrace in tests 2023-01-02 22:10:08 +08:00
oxalica
4f8b44dea0 Fix fmt 2023-01-01 05:16:16 +08:00
oxalica
2e688f98a4 Fix clippy warnings 2022-12-30 19:29:38 +08:00
oxalica
b65a0c7655 Use modifier withAttribute for identifiers from with
This allows editors to add special emphasis style like underlines to
them.
2022-12-30 19:29:38 +08:00
oxalica
0fb9e13883 Add constant and builtin for semantic tokens
The `defaultLibrary` doesn't quite fit builtins, since the former also
include standard library and are not considered "language essentials".
2022-12-09 22:12:49 +08:00
figsoda
661af99ab6 Add remove_empty_inherit assist 2022-12-08 06:29:36 +08:00
figsoda
101387fb2f Add add_to_top_level_lambda_param assist 2022-12-06 04:54:54 +08:00
figsoda
cbc6298c7a Add multiple rhs support for convert_to_inherit assist 2022-12-06 04:53:34 +08:00
oxalica
46eeb57f9b Add { and } getters for Pat 2022-12-05 02:12:53 +08:00
figsoda
ef9bdb801e add convert_to_inherit for { a.b = b; } 2022-12-02 05:22:18 +08:00
oxalica
f62a769325 Limit semantic token range to fix performance issue 2022-12-01 07:41:39 +08:00
oxalica
8f8a5d2cff Fix highlight kind 2022-11-28 00:57:20 +08:00
oxalica
10e7fc394b Impl documentHighlight 2022-11-28 00:40:58 +08:00
oxalica
eb7c84c429 Remove rowan dependency from crates except syntax 2022-11-26 17:58:00 +08:00
oxalica
8001f0d71b Don't highlight string fragment
Fragment highlighting would overwrite the highlighting of injected
languages.
2022-11-26 16:33:32 +08:00
oxalica
84e39a65c9 Allow disable diagnostics for some files 2022-11-25 23:42:43 +08:00
oxalica
9794a2eb97 Impl assist to flatten Attrset in bindings 2022-11-25 01:23:33 +08:00
oxalica
655d5247a6 Impl assist to pack bindings 2022-11-25 00:23:22 +08:00
oxalica
1f5d8ceee0 Simplify and fix tests for assists 2022-11-24 23:07:31 +08:00
oxalica
f1304942e3 Fix rust 1.64 compatibility
nixpkgs still have rust 1.64 on master.
2022-11-24 19:20:42 +08:00
oxalica
8d32b2a081 Impl code action for converting to inherit 2022-11-24 03:43:03 +08:00
oxalica
bea40f71fc Impl string unescaping by parts 2022-11-17 03:11:21 +08:00
oxalica
c4bcb3015b Impl indent string stripping 2022-11-17 02:59:14 +08:00
oxalica
276615a48d Add tests for syntax::semantic 2022-11-16 23:11:27 +08:00
oxalica
170f89761d Complete and add tests for AST getters 2022-11-16 22:40:36 +08:00
oxalica
4087d3acde Optimize searching let and rec in Attrset 2022-11-16 21:39:53 +08:00
oxalica
1ac520b784 Refactor Attrset desugaring and move out some logic 2022-11-16 21:22:27 +08:00
oxalica
3fa46cc956 Track Attr source info in Ty 2022-11-14 20:17:34 +08:00
oxalica
dfffc45c35 Simplify and unify convertion helpers 2022-11-11 05:56:39 +08:00
oxalica
a13e89c622 Fix dead lock in apply_vfs_change 2022-11-11 05:26:55 +08:00
oxalica
d0a5ea4364 Fix PID waiter impl 2022-11-10 16:31:59 +08:00
oxalica
93f15d882f Impl document links 2022-11-10 03:31:23 +08:00
oxalica
3749c6bb3a Keep literal strings during lowering 2022-11-10 03:31:23 +08:00
oxalica
e3ce3bfca0 Move identifier check and quoting into syntax 2022-11-10 01:25:01 +08:00
oxalica
1e3fdf59cb Fix type for condition expr of if 2022-11-09 23:07:15 +08:00
oxalica
f43380d009 Tweak type formatter 2022-11-07 14:47:06 +08:00
oxalica
e8659c2e08 Fix clippy 2022-11-07 13:58:56 +08:00
oxalica
3171734d0d Show hover message for selection Attr 2022-11-07 13:56:25 +08:00
oxalica
72db1ef2bc Impl completion triggered . and ? 2022-11-07 12:58:01 +08:00
oxalica
2997e14a66 Fix completion inside non-last Attr 2022-11-07 12:29:30 +08:00
oxalica
d714bedf1e Construct empty NAME nodes for recovery 2022-11-07 11:24:30 +08:00
oxalica
efca332ce9 Complete attrset fields 2022-11-07 10:50:59 +08:00
oxalica
2cd3354204 Show types in hover messages 2022-11-07 09:35:09 +08:00
oxalica
8e4b0d6764 Initial impl for type inference 2022-11-07 09:14:10 +08:00
oxalica
19871b3842 Move string-related desugaring into syntax crate 2022-11-03 03:41:03 +08:00
oxalica
c064894105 Monitor client process's liveness on Linux
Some client use UNIX domain sockets for communitation. But they are not
automatically closed when the client exits abnormally, resulting leaked
server instances.
2022-10-22 14:24:51 +08:00
oxalica
c84d1619d0 Refactor API of VfsPath 2022-10-11 02:44:14 +08:00
oxalica
756be130c8 Handle workspace/didChangeWatchedFiles
This notification is sent unexpectedly by VSCode, observed in #24.
2022-10-04 05:06:55 +08:00
oxalica
2a9dcd5b15 Resolve Path to VfsPath instead of FileId
This allows resolving to files not loaded. File existence check is
delayed to LSP server side.
2022-10-04 05:01:50 +08:00
oxalica
eb71b56015 Fix lost root changes 2022-10-04 04:03:19 +08:00
oxalica
31b714f3da Use absolute VfsPath and remove file preloading
We currently don't enable any workspace features.
Reading file on demand can be more robust and memory efficient.

Fixes #21
2022-09-28 17:56:20 +08:00
oxalica
ec7d3490f2 Report duplicated lambda parameters 2022-09-27 22:41:22 +08:00
oxalica
ac84014360 Clarify build requirements and add CI 2022-09-27 22:23:22 +08:00
oxalica
5f1eab84a6 Async diagnostics calculation 2022-09-27 21:20:36 +08:00
oxalica
ca9c97143b Impl multi-threading and request cancellation 2022-09-27 21:09:03 +08:00