Commit Graph

405 Commits

Author SHA1 Message Date
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
Sora
94882d2e64
Update config to highlight danger of the comptime interpreter (#1162) 2023-04-30 13:21:43 -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
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
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
nullptrdevs
e1d90a1a1b More . completion 2023-03-23 15:01:23 +00:00
Auguste Rame
3586a7858e
Fix scope creation for label blocks (#1074) 2023-03-17 15:02:51 -04:00
Techatrix
12014cd93d fix typos 2023-03-15 17:34:23 +01: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
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
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
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
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