Commit Graph

1067 Commits

Author SHA1 Message Date
Techatrix
fa5828496e
Generate data files in config_gen.zig (#903)
* generate data files in config_gen.zig

* remove trailing comma from config.json

* update README.md

* run zig build gen

* handle some unclosed tags

* update data file header

* generate new data files

* remove old data file generators
2023-01-19 01:46:42 -05:00
Techatrix
0c24f8e2a9 update pointer type tests 2023-01-17 20:49:11 +01:00
Techatrix
985cfb6d06 implement union values 2023-01-17 20:37:34 +01:00
Techatrix
30f919d854 optimize hashing and equality checks on structs 2023-01-17 20:36:33 +01:00
Techatrix
2ea97a050b improve Function memory layout 2023-01-17 20:35:42 +01:00
Techatrix
fb3a4238d7 update tests 2023-01-17 20:32:49 +01:00
Techatrix
407f921ef8 refactor type printing 2023-01-17 20:23:27 +01:00
Techatrix
9e74afada6
show better zig/zls version mismatch messages (#917)
* show better zig/zls version mismatch messages

* always show message if versions don't match

* ignore patch
2023-01-16 13:49:00 -05:00
Techatrix
af85a9550d
simplify formatting handler (#916) 2023-01-16 13:47:55 -05:00
Techatrix
4e4761b34c
fix use after free for builtin completions (#914) 2023-01-16 13:47:06 -05:00
Techatrix
8d53a5382d
resolve type of @typeInfo (#915) 2023-01-16 13:46:33 -05:00
Techarix
739bd08b7b fix storage of negative signed integer values 2023-01-16 12:38:35 +01:00
Techatrix
82e3ab9f2e more tests 2023-01-15 18:25:00 +01:00
Techatrix
45f03ca239 add bit_offset & host_size to Pointer 2023-01-15 15:41:54 +01:00
Techatrix
bdf207a821 small refactor on ComptimeInterpreter 2023-01-14 21:49:27 +01:00
Techatrix
d49979d002 remove arena from ComptimeInterpreter 2023-01-14 21:30:52 +01:00
Techatrix
969efdfba0 more tests 2023-01-14 21:27:55 +01:00
Techatrix
5dca172c31 small cleanup 2023-01-14 19:51:44 +01:00
Techatrix
1456bfa1c6 refactor InternPool KeyAdapter 2023-01-14 19:17:06 +01:00
Techatrix
04d281340c restructure ComptieInterpreter tests 2023-01-14 14:08:15 +01:00
Techatrix
98899ed0cf some ComptieInterpreter work 2023-01-14 14:07:52 +01:00
Alex Kladov
61fa98065f
fix use after free (#911) 2023-01-11 20:18:37 +00:00
Lee Cannon
20d29fd491
move log overrides into std_options (#902) 2023-01-10 16:52:03 -05:00
Techatrix
4423a5face
improve memory allocations (#889)
* improve memory allocations

* Update src/main.zig

Co-authored-by: erikarvstedt <36110478+erikarvstedt@users.noreply.github.com>

* add missing 0x21

Co-authored-by: erikarvstedt <36110478+erikarvstedt@users.noreply.github.com>
2023-01-09 11:09:36 -05:00
Auguste Rame
21b103c158
Fix build runner cwd causing relative @src (#898)
Co-authored-by: Nameless <truemedian@gmail.com>

Co-authored-by: Nameless <truemedian@gmail.com>
2023-01-08 23:13:20 -05:00
Techatrix
68790c73a7
return from main instead of calling exit (#894) 2023-01-08 23:13:02 -05:00
Techatrix
e9b364772d
fix returning freed memory in formattingHandler (#890) 2023-01-07 16:33:10 -05:00
Techatrix
54e7d1da8b
fix compile errors when targeting wasm (#886)
* fix compile errors when targeting wasm

* update known-folders
2023-01-07 15:21:20 -05:00
Techatrix
3f2700eaa5
improve completion on error and enums (#887) 2023-01-06 13:59:20 -05:00
Techatrix
27d91d100f more tests 2023-01-06 15:02:45 +01:00
Techatrix
909424cada error set type formatting 2023-01-06 15:01:48 +01:00
Techatrix
650eaeb66c implement anyframe->T 2023-01-06 14:38:28 +01:00
Techatrix
f0c888188a refactor and basic struct/union value implementation 2023-01-06 14:12:29 +01:00
mlugg
b163be51d3
Fix crash when using nvim-lspconfig (#884)
Apparently, nvim reports its code action kinds using both the actual
strings (e.g. "refactor.extract") and the enumeration names (e.g.
"RefactorExtract"). I don't know why this is done - possibly an attempt
at compatibility with non-compliant server implementations? Regardless,
this was causing a crash on init (when tres tried to parse an
initializaiton message), which is easily fixed by just supporting those
enumeration values.

Resolves: #867
2023-01-05 13:50:02 -05:00
Techatrix
8828ff117d more comptime interpreter work 2023-01-04 11:11:48 +01:00
Techatrix
651955399e remove namespace and decl from intern pool 2023-01-04 11:10:46 +01:00
Techatrix
5598ad032b partially implement peer type resolution for pointer types 2023-01-04 09:53:48 +01:00
Techatrix
475da58895 finish and test peer type resolution among integers and floats 2023-01-04 06:07:39 +01:00
Techatrix
d56a274c16 Merge branch 'master' into intern-pool 2023-01-04 04:42:06 +01:00
Auguste Rame
20baa592eb
Add error return trace (#882) 2023-01-03 15:37:59 +00:00
Techatrix
a574ac68ba
use more explicit error sets (#880) 2023-01-03 10:21:58 -05:00
Techatrix
c718e12d16
Autofix improvements (#879)
* improve autofix stability and client support

* run zig fmt
2023-01-02 14:59:01 -05:00
Techatrix
9badc745c5
remove setup wizard (#878)
* remove setup wizard

* add back findZig function
2023-01-02 13:54:13 -05:00
Techatrix
b95d5095af
enable all capabilities by default (#877) 2023-01-02 04:02:28 -05:00
Techatrix
3449269fd3
Add a replay feature to zls (#857)
* add config options for `zls --replay`

* implement `zls --replay`

* remove carriage return from zls replay files

* add missing arguments for Server.init in tests
2022-12-31 01:45:45 -05:00
Techatrix
417bf9bd0a
add vscode config generation to zig build gen (#862)
* add vscode config generation to `zig build gen`

* correctly handle removing configs in config_gen.zig

* update log messages in config_gen.zig
2022-12-30 18:45:31 -05:00
Techatrix
d86d05d969
fix ast-check with single error (#865) 2022-12-30 18:43:40 -05:00
Techatrix
94ec3a0a86
Debugging utilities (#860)
* add debug printing for Ast and DocumentScope

* add optional failing allocator
2022-12-30 18:42:53 -05:00
Techatrix
f473088b64
fix crashes found through fuzzing (#866) 2022-12-30 18:42:28 -05:00
Techatrix
c88562ca78
optimize build.zig discovery (#863) 2022-12-29 18:21:26 -05:00
Techatrix
978e41b8a5
always use scoped logs instead of default (#864) 2022-12-29 18:20:12 -05:00
Álan Crístoffer
c6d74dbca5
fix: tres not available in a nix environment. (#855) 2022-12-29 13:36:38 -05:00
Rekai Musuka
aabdb0c6ec
fix: update master.zig to reflect changes to builtins (#858) 2022-12-29 01:00:32 -05:00
Techatrix
ebe3ba1471
Memory lifetime fixes (#861)
* fix memory lifetime issues

* more memory lifetime issue fixes
2022-12-29 00:59:19 -05:00
Techatrix
61c0981294
Use zig-lsp-codegen (#850)
* add lsp.zig

* change references from types.zig to lsp.zig

* remove types.zig and requests.zig

* add tres as a submodule

* transition codebase from types.zig to lsp.zig

* update lsp.zig

* completely overhaul message handler

* fix memory errors

* partially transition tests to lsp.zig

* update lsp.zig

* more test fixes

* disable failing tests

* fix message handling bugs

* fix remaining tests

* access correct union in diff.applyTextEdits

* more message handler fixes

* run zig fmt

* update tres submodule

* fix memory access to freed memory

* simplify initialize_msg for testing

* check if publishDiagnostics is supported
2022-12-27 01:47:57 -05:00
Techatrix
941882371c
fix memory lifetime issues (#851) 2022-12-27 00:52:15 -05:00
travisstaloch
3139a787a1
fix another underflow in ast.zig#fullWhile() (#853) 2022-12-27 00:45:52 -05:00
Techatrix
6118686d00 fix remaining compiler errors 2022-12-27 03:02:07 +01:00
Techatrix
03e50066a1 Merge branch 'master' into intern-pool 2022-12-27 01:53:55 +01:00
Techarix
04448d1a7b more intern pool work 2022-12-27 02:46:57 +01:00
travisstaloch
faae689ff7
prevent underflow in ast.zig#fullWhile() (#848) 2022-12-25 17:44:25 -05:00
Ryan Liptak
f6c15ac10c
semantic_tokens: Fix handleComments not evaluating the last byte (#844)
Fixes #842
2022-12-22 22:27:38 -05:00
rimuspp
4d7b95e1e2
generated master data for new builtins (#845) 2022-12-22 22:26:29 -05:00
Eric Puentes
44b6c4dae4
fix: avoid finding references in the current file twice (#846) 2022-12-22 22:25:56 -05:00
Auguste Rame
c355a54dd1
Fix raw, responseless returns on willSaveWaitUntil (#833)
* Fix raw, responseless returns on willSaveWaitUntil

* Make this code pretty
2022-12-19 16:01:08 -05:00
Steven Kabbes
427620742a track builtin API changes from zig/master
see: https://github.com/ziglang/zig/pull/13930
In this PR, std.builtin.Type.field_type is renamed to type
And there is discussion that all Enum layouts are .Auto
2022-12-18 12:45:36 -07:00
Lee Cannon
e65d5c5c23
Merge pull request #834 from travisstaloch/fix-for-issues-754-832
analysis.zig getPositionContext() - check for null
2022-12-18 00:56:30 +00:00
Travis Staloch
e09c773005
analysis.zig getPositionContext() - check for null
closes #754 and #832

this pr just adds `.label => {}` to the switch as suggested by
@nullptrdevs, thereby preventing the null unwrap.  i checked that zls no
longer crashes when positioning the cursor on Server.zig:2287:41 which
is this line:
  `break :blk .{ .WorkspaceEdit = edits };`
                              ^ cursor here previously crashed zls
2022-12-17 15:37:49 -08:00
Techatrix
375daba743
improve behavior if zig_exe_path is not set (#830) 2022-12-17 03:03:05 -05:00
Techatrix
d679b19676
remove old stage1 code artifacts (#831) 2022-12-17 03:02:31 -05:00
Techatrix
5d6f23b5f1
fix integer underflow in ast.fullPtrType (#829) 2022-12-16 15:24:25 -05:00
Techatrix
e1973afafc
fix cimport duplicate messages & crash (#828) 2022-12-16 15:24:03 -05:00
Techatrix
68ac6f9f30
remove ast.tokenSlice() (#824) 2022-12-15 17:01:42 -05:00
Techatrix
c39a4eb2ab
simplify & refactor analysis code (#823) 2022-12-15 13:03:09 -05:00
nullptrdevs
3526f5fb84
Zig @call changes (#822)
First parameter is now a `std.builtin.CallModifier`.
2022-12-14 20:58:38 -05:00
Auguste Rame
d43329a9ee
Fix labels for real this time (#819) 2022-12-14 05:51:01 -05:00
Auguste Rame
0ab34abc0f
Bug stream fixes (#818)
* Fix glaring inlay hint issue; thanks for the report Nameless

* Fix label references; closes #728
2022-12-13 22:07:36 -05:00
Lee Cannon
878464ea72
Merge pull request #816 from alexnask/ascii-deprecated-removed
Use new versions of now removed std.ascii declarations
2022-12-12 00:18:23 +00:00
Lee Cannon
974bdff6b3
fix missed reference on windows 2022-12-12 00:13:13 +00:00
Techarix
748cd7d6a9 Merge remote-tracking branch 'origin/master' into intern-pool 2022-12-11 19:02:24 +01:00
Techatrix
1ae341850e
automatically generate config associated files (#813) 2022-12-11 13:10:48 +02:00
Alexandros Naskos
3cac23f8a1
Fix references to now removed, previously deprecated std.ascii declarations 2022-12-10 23:21:55 +02:00
Lee Cannon
9e658cdbb6
update TracyAllocator for new Allocator changes (#812)
* update TracyAllocator for new Allocator changes

* Add build with Tracy to CI to catch regressions

* disable Tracy CI step on macos
2022-12-08 14:32:50 -05:00
Joseph Stahl
887539ed1a
Allocator.resize() does not adjust size of string allocated for URI to file path conversion (#806)
* fix missing backslash

* fix: zls escaping colon to %3A on URIs

ZLS escapes a colon char ":" as "%3A" when encoding file paths to URIs
When decoding, need to make the target string 2 character shorter
to compensate for length decrease when replacing %3A with :

* add new failing test because of resize()

* revert changes to %3A handling - problem seems to be with allocator.resize

* switch to realloc

* Fix test failures, revert errdefer->defer

* platform-specific URI tests

URI parsing is highly platform-specific
run Unix-style (file:///home/main.zig) on non-Windows test runners,
run Windows-style (file://c%3A/main.zig) on Windows test runners
2022-12-04 16:44:22 -05:00
Auguste Rame
580469cd32
Fix rogue resize, bump minimum version (#805) 2022-12-03 21:35:51 -05:00
Alex Kladov
cfb0b023ad
fix #801, IOOB in foldingRanges (#802)
* Add smoke tests for folding ranges

* fix index out of bounds in foldingRanges

closes #801

For invalid syntax trees, zig's parser seems to return bogus data where
startToken > endToken, which then causes everything else to crash.

This seems like a deeper issue, which needs to be fixed "properly", but
let's just paper over it here.
2022-12-03 17:23:13 +02:00
Alexandros Naskos
3ab859a304
Make sure zig lib path retrieved from zig env is absolute (#799) 2022-12-02 23:22:35 +02:00
Auguste Rame
6ab2c68355
Allocgate 2.0 slain (#791)
* Allocgate 2.0 slain

* Tests now compile, but they fail

* Temporary bruteforce
2022-12-02 15:14:58 -05:00
Techatrix
4f180712bb add initial intern pool implementation 2022-12-02 00:08:45 +01:00
Techatrix
784047d952
add a dummy cancelRequest implementation (#790) 2022-12-01 04:00:08 -05:00
Lee Cannon
c3256c00e7
pass correct zig-cache path (#789) 2022-11-29 17:50:09 -05:00
Alexandros Naskos
56a65f42bf
Added tuple type support, fixed compilation with zig master branch (#786)
* Added tuple type support, fixed compilation with zig master branch

* Removed unneeded comment

* Bumped up minimum zig version required to build zls
2022-11-26 12:22:16 -05:00
Aleksey Kladov
8731a37d1f textDocument/selectionRange
closes #777
2022-11-26 11:31:46 +00:00
Techatrix
aa14772cfe
use textDocument/willSaveWaitUntil for autofix (#780) 2022-11-25 16:32:08 -05:00
Techatrix
1ced17266c
set TextDocumentSync to Incremental (#776) 2022-11-22 21:05:29 -05:00
nullptrdevs
4794f1e8d9
Disable label references until #728 is resolved 2022-11-22 02:08:43 -08:00
Techatrix
ea2caee3ad
correctly find last full text change in applyTextEdits (#772) 2022-11-21 13:21:24 -05:00
halting
5f3d58edeb
fix anytype snippet (#769)
i forgot that
2022-11-20 15:16:15 -05:00
halting
245e11e033
snippets for primitive types (#767) 2022-11-19 14:59:12 -05:00
Techatrix
f09ffb63db
don't format files with syntax errors (#766)
* don't format files with syntax errors

* Remove showMessage

Co-authored-by: Auguste Rame <19855629+SuperAuguste@users.noreply.github.com>
2022-11-18 18:49:59 -05:00
halting
d1aeec4c41
update snippets 2022-11-17 11:24:00 -03:00
Auguste Rame
87aa4c09e1
Quick comptime interpreter fix, place it behind an option (#761)
* Quick fix

* Add config option
2022-11-16 19:28:01 -05:00
Auguste Rame
355d56376f
Merge pull request #724 from zigtools/comptime-bebe-steps
Implement comptime interpreter
2022-11-16 18:13:35 -05:00
Techatrix
28be9a4cc7
report actual zls version in initialize response (#759) 2022-11-16 17:58:37 -05:00
Techatrix
31584cff60
find references in while continue expressions (#758) 2022-11-16 17:35:51 -05:00
Techatrix
46da74d32e
don't iterate handles while potential invalidation occurs (#757) 2022-11-16 17:35:19 -05:00
Techatrix
d75fd3a880
detect comment position context (#756) 2022-11-16 17:34:36 -05:00
Techatrix
662b560861
format with Ast.render instead of zig fmt (#755) 2022-11-16 17:33:15 -05:00
Ingo Lohmar
e98aea61ea
do not panic on error response to workspace/configuration (#747) 2022-11-13 17:28:00 -05:00
Auguste Rame
c8dffc1f9b
Some comptime interpreter fixes 2022-11-10 20:51:02 -05:00
Auguste Rame
c803a5de3f
Quick cleanup 2022-11-09 23:46:23 -05:00
Auguste Rame
411e74d364
Add param type resolution & stop using stage2, still a bit broken :( 2022-11-09 23:17:21 -05:00
Nick Cernis
e58bddd769
Improve Zig version mismatch error (#744)
Improves the server message we send if the system Zig version is older
than the Zig version that ZLS was built with:

- Correct typo (“build with” → “built with”).
- Show versions so users know which one they need to update to.
- Suggest step needed to fix the error (“Update Zig…”).
2022-11-09 23:13:35 -05:00
Auguste Rame
b91a193d04
We can interpret std now because of proper tree shaking! 2022-11-08 14:42:40 -05:00
Auguste Rame
c6ab7e8a0f
Casts++, compileLog, pointers 2022-11-08 14:42:40 -05:00
Auguste Rame
e6b691e447
More builtins, use stage2 because we can 2022-11-08 14:42:33 -05:00
Auguste Rame
d2e166bb0b
Some builtins, rudimentary hacky diagnostics; need to nerf global evaluation 2022-11-08 14:37:14 -05:00
Auguste Rame
599c134593
Imports, cross-boundary resolution; can import std but dies on missing builtins / lang features 2022-11-08 14:37:13 -05:00
Auguste Rame
da00751726
Field access, function calls based on function value 2022-11-08 14:37:13 -05:00
Auguste Rame
779c3c0710
Hacky mess but it works (only if your function is the first root decl tho :P) 2022-11-08 14:37:13 -05:00
Auguste Rame
06e8756849
Add struct test 2022-11-08 14:37:13 -05:00
Auguste Rame
d2640a44ac
comptime interpreter moment 2022-11-08 14:37:01 -05:00
BratishkaErik
95f21d0d23
Add builtin data for 0.9.1 and 0.10.0 (#735)
* Add builtin data for 0.9.1

* Add builtin data for 0.10.0

* Update builtin data for master
2022-11-02 16:24:51 -04:00
Tom Cheng
af14067911 Fix crash when getting signature of optional
e.g. typing 'foo.?.bar(' crashes zls because it doesn't recognize ? as a
possible token as part of a function expression, and tries to call
getFieldAccessType with '.bar' instead.

The actual fix is the one line in src/signature_help.zig

getFieldAccessType was reworked to be more resilient to this type of
thing - the `undefined` value of `current_type.type.data` was being used
since it hit the `.period` branch first. This caused the crash.
2022-11-02 14:55:22 +00:00
musi-musi
2ae113ddcf
fixed jrpc config treating empty strings as non null (#727) 2022-10-30 00:30:03 -04:00
Techatrix
7a7576c06d
fix symbol references (#712)
* fix symbol references

* skip references for inline assembly
2022-10-29 04:37:52 -04:00
InKryption
51a7ae2274
Fix region folding off-by-one error (#726) 2022-10-28 16:59:33 -04:00
InKryption
7fe62147a3
Improve folding regions (#720) 2022-10-28 14:35:22 -04:00
Auguste Rame
ced6e97cc2
Fix build runner optional issue (#725) 2022-10-28 04:02:08 -04:00
Techatrix
862d30055a
fix cimport completion (#722) 2022-10-28 00:38:36 -04:00
Techatrix
bca02bfde5
fix invalid union access in build_runner.zig (#723) 2022-10-28 00:37:54 -04:00
Techatrix
88750d2529
fix allocator mismatch in tagStoreCompletionItems (#717) 2022-10-25 23:22:15 -04:00
Luca Sas
2a17590bf4
Added textDocument/foldingRange (#718)
* Added textDocument/foldingRange

* Added support for code regions

* Fixed warning message in foldingRangeHandler

Co-authored-by: LucaSas <sas.luca.alex@gmail.com>
2022-10-25 10:35:16 -04:00
Auguste Rame
5ddbf24d11
Fix diagnostics (#716) 2022-10-21 12:24:26 -04:00
Lee Cannon
6358c5b23e
Merge pull request #714 from Techatrix/fs-completion-fix
fix file system completion crash
2022-10-20 17:39:10 +01:00
Techatrix
a0723dbffd add missing semicolon 2022-10-20 18:25:06 +02:00
IntegratedQuantum
886cfeacb5
Replace @minimum and @maximum with @min and @max. (#713) 2022-10-19 18:26:12 -04:00
Techatrix
7c54ded487
Merge pull request #702 from Techatrix/document-store-refactor
DocumentStore refactor
2022-10-18 11:40:14 +02:00
Techatrix
2755d8d8b7 simplify dependency collection in references.zig 2022-10-17 21:20:27 +02:00
Techatrix
8fb7379d71 return null if file can't be read in documentstore 2022-10-17 20:46:31 +02:00
Techatrix
2158a201ad add separate function for loading handles with getOrLoadHandle 2022-10-17 20:43:11 +02:00
Techatrix
89be8e0211 return const Handle from getHandle 2022-10-17 20:33:37 +02:00
Techatrix
ba007b3558 fix tagStoreCompletionItems 2022-10-17 20:25:51 +02:00
Techatrix
4316524226 add more tracy calls in documentstore 2022-10-17 20:23:51 +02:00
Techatrix
9f688cf4ed simplify tagStoreCompletionItems 2022-10-17 20:20:34 +02:00
Techatrix
0cfc792849 load handles on demand instead of ahead of time 2022-10-16 17:26:06 +02:00
Techatrix
25ce5dd8aa undo DocumentStore constness changes 2022-10-16 17:17:40 +02:00
ryuukk
472e28ad5c
builtins also get their detailed label (#706) 2022-10-14 12:24:22 -04:00
ryuukk
cd887838f7
disable label details if client only support old lsp (#707) 2022-10-13 04:03:58 -04:00
IntegratedQuantum
62861193a6
Allow tabs for the indentation added by code actions. (#684)
* Allow tabs for the indentation added by the code actions feature (#673).

The previous implementation always assumed spaces for indentation.
But in stage2 code may contain tabs for indentation as well.

* Fix some edge cases, properly detect indentation(any amount of spaces) and move the indentation code inside `createDiscardText()`.
2022-10-12 22:41:27 -04:00