Commit Graph

379 Commits

Author SHA1 Message Date
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
Techatrix
30869d7d87
InternPool: replace untyped values with typed values (#1023)
* InternPool: replace untyped values with typed values

* InternPool: remove `indexToTag`

* InternPool: rework representation of optional values

* add representation for unknown values and types

* ComptimeInterpreter: use InternPool typed-values

* ComptimeInterpreter: field access test

* ComptimeInterpreter: improve handling of if expressions

* InternPool: fix typeOf on a comptime float

* ComptimeInterpreter: implement TypeOf with multiple parameters
2023-02-27 17:53:46 -05:00
Techatrix
0f77fd5b0e
add multi object for loop support (#1011)
* run `zig fmt`

* add support for multi object for loops

* add completion tests on multi object for loops

* update minimum zig build version

* use multi object for loops in codebase

* Update tres to latest version

* fix panics when generating document scope on invalid for loops
2023-02-21 17:11:35 -05:00
Auguste Rame
c3f58538e8
Merge pull request #793 from Techatrix/intern-pool
ComptimeInterpreter: Intern Pool
2023-02-15 14:46:58 -05:00
nullptrdevs
dedb9deb08
Fix handling of invalid tokens in getPositionContext (#1006) 2023-02-15 13:33:58 -05:00
Techarix
2dffa9ef25 Merge branch 'master' into intern-pool 2023-02-14 23:48:57 +01:00
nullptrdevs
290ed6e7e7
Avoid integer overflow in analysis.getPositionContext (#998) 2023-02-13 20:09:36 -05:00
nullptrdevs
409c203317
Amend getPositionContext to handle incomplete .string_literals, ie ", @" (#997) 2023-02-13 17:47:57 -05:00
Techatrix
37ca1333ed
implement cInclude completions & goto definition (#970)
* implement cInclude completions & goto definition

* fix cImport features on windows

* fix relative path with `..`
2023-02-11 20:25:55 +00:00
Alex Kladov
73d6264cab
Fix missing nodes in outline (#990)
* Remove some boilerplate from test

* Fix missing nodes in outline
2023-02-11 14:20:01 -05:00
Techatrix
5754f362c6 Merge branch 'master' into intern-pool 2023-02-11 00:41:29 +01:00
Techatrix
d98060b3d6 more closely match Zir.Inst.Ref to InternPool.Index 2023-02-10 19:10:58 +01:00
Techarix
57fc10eec0 add predefined values to Index 2023-02-08 21:01:15 +01:00
Techarix
6278880f42 Merge branch 'master' into intern-pool 2023-02-08 20:10:17 +01:00
Techatrix
8ec82321d4
remove arena allocator from analysis (#981)
* remove arena allocator from analysis

* fuzzer fix

* deinit `BoundTypeParams`
2023-02-07 17:44:04 -05:00
bing
384f227cb7
fix doc comment not showing on container field (#947) 2023-02-03 18:58:53 -05:00
Techatrix
55364f2e2b do not intern Structs, Enums and Unions 2023-01-28 18:02:29 +01:00
Techatrix
9131285db1 improve comptime interpreter stack trace message 2023-01-26 17:14:42 +01:00
Techatrix
ca644d67c1 Merge branch 'master' into intern-pool 2023-01-26 16:16:40 +01:00
Techatrix
fe54fb7cfa
Use new ast helper functions (#939)
* use new ast helper functions

* use new ast helper functions

* update min build version

* fix merge conflicts
2023-01-24 18:55:38 -05:00
Techatrix
d2586f79a1
replace ArrayList with MultiArrayList in DocumentScope (#938) 2023-01-24 15:43:48 -05:00
Techatrix
829f4aa9c4 use analyser/completions.zig for completing comptime interpreter 2023-01-23 22:23:01 +01:00
Álan Crístoffer
903f85ab94
Fix lsp weird behaviour on block cursors (#891) (#905)
* Fix lsp weird behaviour on block cursors (#891)

Adds lookahead option to getPositionContext.
2023-01-22 15:47:53 -05:00
Aleksey Kladov
ea05916e69 Goto definition works when the cursor is at the start of the identifier.
Before, the code lexed only a prefix of the line up to cursor position.
Now, we lex the entire line, and do look at the token just after the
cursor.

This subtly changes sematncih of `getPostionContext`: now it is becomes
oblivious of the _exact_ position of the cursor and returns the whole
token at cursor's position.

I believe this is semantically right approach -- _most_ of the callsite
should not worry at all about such details. Something like completion
_might_ want to know more, but it's better to make that call site's
problem.

It might be the case that some existing code relies on the past
behavior. It's hard to tell though -- we don't have a lot of tests for
_features_, and changes to unit-tests don't explain if the changes are
meaningful for user-observable behavior or not.

In general, for LSP-shaped thing, I feel that the bulk of testing should
be focused on end-to-end behaviors....
2023-01-21 18:31:26 +00:00
Techatrix
ba42fd2bb9 Merge branch 'master' into intern-pool 2023-01-20 22:23:44 +01:00
Techatrix
407f921ef8 refactor type printing 2023-01-17 20:23:27 +01:00
Techatrix
8d53a5382d
resolve type of @typeInfo (#915) 2023-01-16 13:46:33 -05:00
Techatrix
98899ed0cf some ComptieInterpreter work 2023-01-14 14:07:52 +01:00
Techatrix
3f2700eaa5
improve completion on error and enums (#887) 2023-01-06 13:59:20 -05:00
Techatrix
d56a274c16 Merge branch 'master' into intern-pool 2023-01-04 04:42:06 +01: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
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
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
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
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
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
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
Alexandros Naskos
3cac23f8a1
Fix references to now removed, previously deprecated std.ascii declarations 2022-12-10 23:21:55 +02: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
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
d75fd3a880
detect comment position context (#756) 2022-11-16 17:34:36 -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