Commit Graph

1215 Commits

Author SHA1 Message Date
Techatrix
6f0907bc16 fix semantic tokens on union and enum container fields 2023-05-21 21:48:46 +02:00
Techatrix
cde544125a bring semantic token types and modifiers closer to predefined ones 2023-05-21 21:48:46 +02:00
Techatrix
d9965c7834 fix semantic tokens on if capture by ref 2023-05-21 21:48:46 +02:00
Techatrix
498517ba71 replace semantic token type .field with .property 2023-05-21 21:48:46 +02:00
Techatrix
6836f9361d use std.meta.fieldNames instead of manually re-implementing it 2023-05-21 21:48:46 +02:00
Techatrix
ae5fa110b5 test and simplify semantic tokens on function call 2023-05-21 21:48:46 +02:00
Techatrix
3fefcfb398 simplify semantic token comment handling 2023-05-21 21:48:46 +02:00
nullptrdevs
e6996f5f66 Update config_gen and data 2023-05-18 21:23:17 -07:00
Techatrix
3500aa7a76
update to new std.json api (#1191)
* update lsp.zig

* update to new `std.json` api

* update min zig version

* fix json api
2023-05-18 20:46:22 -04:00
Techarix
64fb0246fc access tree of resolved typed on hover 2023-05-16 19:41:46 +02:00
Ai Hoshino
91645612e6
Fix panic caused by custom zls.json path (#1177)
* fix(config): fix panic caused by custom configuration file path.

* fix(config): revert `openDir` related code
2023-05-13 01:53:44 -04:00
Lee Cannon
d0a9911a3a
Merge pull request #1184 from Techatrix/fix-semantic-tokens-on-continue
fix semantic token generation crash on continue expression
2023-05-11 12:36:04 -07:00
Lee Cannon
8601b3f790
remove usage of std.meta.tagName as it is deprecated (#1186) 2023-05-10 15:39:32 -04:00
Techarix
1bbdcab3ac fix semantic token generation crash on continue expression 2023-05-10 15:05:29 +02:00
Techatrix
d3f127e78e
Update tracy to 0.9.1 (#1182)
* update tracy to 0.9.1

* set allocation and callstack tracing by default when tracy is enabled
2023-05-09 18:38:09 -04:00
Techatrix
029f5094ff
various intern pool & comptime interpreter changes (#1179)
* intern_pool: add getUnsignedInt

* add an empty struct literal

* resolve array length as usize in comptime interpreter

* use only one global intern pool

* store analysis errors in `DocumentStore.Handle`

* add typed undefined value

* add typed null value
2023-05-09 00:25:26 -04:00
Techarix
f2c064c957 update stage2 sources 2023-05-08 20:38:05 +02:00
Rekai Musuka
95158cf578 chore: update master version data 2023-05-04 00:34:28 -05:00
Lee Cannon
fd05faf51a
print zls version and path during startup (#1165)
* print zls version during startup

* print zls executable path during startup
2023-05-02 18:54:13 -04:00
Sora
94882d2e64
Update config to highlight danger of the comptime interpreter (#1162) 2023-04-30 13:21:43 -04:00
travisstaloch
1ef3944cb0
chore: use new @memset api (#1156) 2023-04-27 18:27:59 -04:00
nullptrdevs
30c49e11df Update config_gen and data 2023-04-26 00:42:38 -07:00
Lee Cannon
71e819c56a
Merge pull request #1148 from nullptrdevs/misc-fixes
Mem fixes
2023-04-24 14:59:57 +01:00
Lee Cannon
d4bc2c2349
Merge pull request #1150 from Techatrix/gen-data-files
update config gen according to new `std.http` changes
2023-04-24 14:58:52 +01:00
Mridul Krishna Mishra
d122cbf157
Fix to make zls compile for 0.11.0-dev.2775+21aa55d34. 2023-04-24 17:19:48 +05:30
Techatrix
5fd5ae0677 update config gen according to new std.http changes 2023-04-23 19:11:04 +02:00
nullptrdevs
5519b3a2c0 Mem fixes
* `gpa.deinit()` now returns an enum
* avoid double free when `--config-path` is specified
* avoid leaking memory in `Server.create` if `configChanged` returns err
2023-04-22 06:47:36 -07:00
Lee Cannon
825cbd2e07
Merge pull request #1142 from Techatrix/iterate-asm
implement `iterateChildren` on asm
2023-04-17 23:03:15 +01:00
Techatrix
92eaa22c30 implement iterateChildren on asm 2023-04-17 23:03:54 +02:00
Lee Cannon
811de07706
Merge pull request #1141 from Techatrix/intern-pool
InternPool: add c_char type
2023-04-17 21:55:12 +01:00
Techatrix
c77e3cebeb update data files 2023-04-17 21:53:35 +01:00
Techatrix
31aec11b38 InternPool: add c_char type 2023-04-17 22:14:41 +02:00
Casey Banner
3ae56929fc
Implement $/setTrace and add --enable-message-tracing (#1135) 2023-04-16 12:04:42 -04:00
Jakub Konka
5457cec8da
update to latest zig: add c_char type (#1124)
* update to latest zig: add c_char type

* Bump version, add c_char to isTypeIdent
2023-04-13 22:02:18 -04:00
Lee Cannon
7978485aaf
Merge pull request #1116 from nullptrdevs/nested-struct-init
Nested struct init fields completion
2023-04-13 13:14:20 +01:00
Lee Cannon
fe4c9d5a8b
Merge pull request #1122 from arp242/prefer-text
Use plain text if the client tells zls it's preferred
2023-04-13 13:13:15 +01:00
Ali Chraghi
42d582c0a2 Update configuration.zig 2023-04-13 09:58:42 +01:00
Martin Tournoij
622efdcd6a
Use plain text if the client tells zls it's preferred
LSP clients send a list of supported formats for definition and
completion; the specification says "the order describes the preferred
format of the client."[1]

My client sends:

	'hover': {'contentFormat': ['plaintext', 'markdown']},

So it should prefer plaintext, using markdown if that's not supported by
the server. zls behaved slightly different: it would use Markdown if it
appears at all in the list of supported formats.

This fixes it so that it will use plain text if that appears before
'markdown' in the list.

[1]: https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#textDocument_hover
2023-04-13 07:33:43 +02:00
Techatrix
d2287816a7 disable assertions in smallestEnclosingSubrange 2023-04-12 23:44:39 +01:00
nullptrdevs
735f884394 Nested struct init fields completion 2023-04-05 10:57:06 -07:00
nullptrdevs
55b1aeb6f7
Avoid accessing inactive union fields in completeDot (#1115)
As reported on Discord by CodotakuYT:
```zig
fn populate(T: type, index: i32) T {
    _ = index;
    @typeInfo(T).struct.
}
```
```
thread 17384 panic: access of union field 'ast_node' while field 'param_payload' is active
C:\Users\taoua\zls\src\features\completions.zig:875:61: 0x7ff68070caac in completeDot (zls.exe.obj)
                const node_data = nodes_data[local_decl.decl.ast_node];
```
2023-04-05 10:28:21 -04:00
Auguste Rame
7814a05921
Remove format lt 512 diff restriction (#1109) 2023-04-04 16:23:44 -04:00
Auguste Rame
ace6d7f32b
Remove outdated diagnostics check (#1106) 2023-04-03 13:42:22 -04:00
Auguste Rame
471d971d1d
Merge pull request #1000 from Techatrix/stage2-zir
Embed AstGen into ZLS
2023-04-01 23:08:40 -04:00
Auguste Rame
99af009232
Disable build file config runs for WASI (#1102) 2023-04-01 23:07:38 -04:00
Techarix
018569888f explain how AstGen will diverge from zig codebase 2023-04-01 23:03:51 +02:00
Techarix
4215edbc33 add support for running ast-check without zig 2023-04-01 23:03:51 +02:00
Techarix
c06cf6e95c add zig code for generating Zir 2023-04-01 22:44:56 +02:00
Auguste Rame
8b5c649805
Add anytype resolution based on call references (#1067) 2023-03-31 11:54:46 -04:00
Auguste Rame
c217502670
Make Analyser use its own arena (#1101) 2023-03-29 14:36:32 -04:00
Techatrix
9a7d262e6c only include snippet completions when enable_snippet is set 2023-03-26 16:20:15 +01:00
Techatrix
90b468ac9f update snippet data 2023-03-26 16:20:15 +01:00
Techatrix
29037f2f05 disable .fixall autofix mode 2023-03-26 16:19:38 +01:00
Techatrix
283ca0006d Apply suggestions from code review
Co-authored-by: Lee Cannon <leecannon@leecannon.xyz>
2023-03-26 16:19:00 +01:00
Techatrix
4b042a562a exclude default cimport declarations from completions 2023-03-26 16:19:00 +01:00
Lee Cannon
f24fcc2b1e
disable cimport resolution (#1091) 2023-03-23 13:28:42 -04:00
Techatrix
1e733a8782 fix block label completion test 2023-03-23 15:13:33 +00:00
Techatrix
84228a612e improve source location of block scope with invalid ast 2023-03-23 15:13:33 +00:00
Techatrix
7e652a5527 refactor document scope creation to be more aware of block expressions 2023-03-23 15:13:33 +00:00
Techatrix
53c7e5bed7 remove TODO's about redefinition errors i favor of ast-check 2023-03-23 15:13:33 +00:00
Techatrix
419527a40d update handling of some node tags in makeScopeInternal 2023-03-23 15:13:33 +00:00
Techatrix
775c38f5f5 implement document scope creation for array_type_sentinel 2023-03-23 15:13:33 +00:00
Techatrix
72228e2b41 fix printDocumentScope 2023-03-23 15:13:33 +00:00
Veikka Tuominen
61b42ca63a make semantic token configuration an enum 2023-03-23 15:02:12 +00:00
nullptrdevs
e1d90a1a1b More . completion 2023-03-23 15:01:23 +00:00
nullptrdevs
9723a92508 Struct init fields completion. 2023-03-21 17:46:33 +00:00
Lee Cannon
a9295769e7
hack latest build changes (#1077) 2023-03-18 20:50:26 -04:00
Techatrix
4b034f1afb
Rework file structure (#1069)
* move language feature files into separate folder

* move code completions into features/completions.zig

* move goto definition/declaration into features folder

* move hover into features folder

* restructure imports

* move selection range into features folder

* restructure request handling tracy call

* add missing features to `zls.zig`
2023-03-17 23:01:41 +01:00
Auguste Rame
3586a7858e
Fix scope creation for label blocks (#1074) 2023-03-17 15:02:51 -04:00
Techatrix
0aacb76743
support enums in config_gen (#1072)
* support enum types in config_gen

* fix typo
2023-03-17 02:27:35 -04:00
Techatrix
12014cd93d fix typos 2023-03-15 17:34:23 +01:00
Lee Cannon
985e7069a2
tracy: workaround zig bug (#1066) 2023-03-15 11:59:56 -04:00
Techatrix
c2d15bfc9a only return block scopes from innermostBlockScope 2023-03-14 15:16:30 +00:00
Techatrix
487281f8e2 improve variable lookup performance 2023-03-14 15:16:30 +00:00
Techatrix
f5897569c4 do not store Handle pointer in Analyser 2023-03-14 15:16:30 +00:00
Techatrix
9d7012596a replace unnecessary std.ArrayListUnmanaged in document scope 2023-03-14 15:16:30 +00:00
Techatrix
ea02e4364f remove had_root global 2023-03-14 15:16:30 +00:00
Techatrix
0ff0a193cc simplify analysis by introducing a Analysis Struct 2023-03-14 15:16:30 +00:00
Techatrix
865e5efe8b refactor semantic tokens 2023-03-14 14:56:11 +00:00
Techatrix
bbc082d102 update config gen to work with vscode-zig 2023-03-14 14:27:18 +00:00
Techatrix
dc7efa591c resolve relative include directories 2023-03-14 14:25:13 +00:00
Auguste Rame
ef4a0607fb
Add some more basic overflow checks (#1055) 2023-03-12 01:53:05 -05:00
Techatrix
a959f161e9
find references on test decl with identifier name (#1051) 2023-03-12 01:24:54 -05:00
Techatrix
ab23ff3616
Optimize document symbols (#1050)
* optimize document symbol generation

* match folding range index to position conversion and documentation to document symbol's

* skip function decls with no name

* skip document symbol field in opaque type
2023-03-12 01:24:42 -05:00
Techatrix
c203110555
more tracy calls (#1052) 2023-03-11 13:43:14 -05:00
Techatrix
ff467f9878
InternPool: add more helper functions and debug formatting (#1043) 2023-03-11 12:37:06 -05:00
Techatrix
333fcb5633
minor semantic token fixes (#1044)
* improve analysis and highlighting of error sets

* emit semantic token for unresolved identifiers

* minor semantic token fixes
2023-03-11 12:36:48 -05:00
Techatrix
3c26892c7e
limit maximum detail length at 1024 bytes (#1048) 2023-03-10 20:06:17 -05:00
Techatrix
ed91fd3823 fix leak in openDocument 2023-03-08 21:52:26 +01:00
Techatrix
d5ac6b9734 rework nodesAtLoc 2023-03-07 09:38:18 -08:00
Techatrix
7a7928f466 fix locIntersect 2023-03-07 09:38:18 -08:00
Techatrix
0ee947e8a6 add Ast to callback field in iterateChildren 2023-03-07 09:38:18 -08:00
Techatrix
0f3319315f implement textDocument/semanticTokens/range 2023-03-07 09:29:39 -08:00
Techatrix
ce9ae21cf4 fix lastToken on tagged union with invalid members 2023-03-07 09:21:46 -08:00
Auguste Rame
2ce59a3bc3
Branching type resolution (#1031)
* Branching type resolution

* Add condition information to completions (borked rn i give up)

* Fix completion conditional descriptor

* Multi gotodef

* Multi hover

* Reenable references

* Fix getAllTypesWithHandles
2023-03-07 12:17:45 -05:00
Techatrix
8e6609e0f5 skip failed cimports on garbage collection 2023-03-07 12:28:20 +01:00
Techatrix
421a05ae5f
send response on shutdown request (#1037) 2023-03-06 13:34:09 -05:00
Techatrix
bb1b1dd102 update version data 2023-03-06 09:32:03 -08:00
dec05eba
76ee4b80fd
Fix crash if zls.json is empty (#1034)
Fixes #1033
2023-03-05 14:09:39 -05:00
Auguste Rame
121f68b970
Fix build runner (#1029)
* Fix build runner

* Add zls module, bump version

* Fix path from root issue in modules (thanks daremakemyday from Twitch :))

* Libraryify

* remove build_runner backward compatibility

* Remove some `= undefined`s in Server.zig

Makes library use less dangerous

* Consistent mem model + custom build runner possible

* Add build runner utils for third-party tooling

* Make logs removable in libraries with zls_ prefix

* Fix build runner CI

* Expose references

* Use new addModule
2023-03-05 14:08:31 -05:00