Commit Graph

1114 Commits

Author SHA1 Message Date
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
89ab9fdf70
make diff.edits memory safe (#1026) 2023-02-27 17:53:16 -05:00
Auguste Rame
ed908a2511
Rerun build.zig configuration extraction on zig_exe_path change (#1027) 2023-02-27 17:52:05 -05:00
Techarix
4b0da6f6ae fix folding range on multi line function declaration 2023-02-25 10:58:29 -08:00
Techarix
97f7fd77c6 fix folding range on structs with doc comment on first field 2023-02-25 10:58:29 -08:00
Lee Cannon
5ede46f003
support new module cli arguments (#1019)
* support new module cli arguments

* capture the runtime zig version and store it on `Server`

* update build_runner action

* Use correct version for selecting arguments
2023-02-23 15:18:52 -05:00
Techatrix
9cb569a196
update version data (#1021) 2023-02-23 00:03:10 +00:00
nullptrdevs
424a06b7ee
completeBuiltin fixes (#1015)
- Always return a copy to avoid memory corruption (most operations assume an arena allocated copy)
- label_details were only generated for the first (pre-fix) disposable copy
- Correct use_snippets logic (send only if configured and client supports them)
2023-02-22 16:30:21 +00:00
Techatrix
36738501cf
ignore an unknown CodeActionKind (#1001) 2023-02-21 22:27:47 +00: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
Lee Cannon
8bd5358748
build_runner: provide valid global cache to the build runner (#1009) 2023-02-17 15:26:03 -05:00
Auguste Rame
c3f58538e8
Merge pull request #793 from Techatrix/intern-pool
ComptimeInterpreter: Intern Pool
2023-02-15 14:46:58 -05:00
Lee Cannon
abe07e601e
Fix build runner for latest changes (#1005)
* build_runner: update to use new caching system

* build_runner: switch ci to use 0.10.1 instead of 0.10.0

* build_runner: support older versions

* build_runner: ensure depreciated functions and types are handled when they are removed

* build_runner: prevent access denied on global cache
2023-02-15 13:36:06 -05:00
Techatrix
4f42c68a0a
improve error message when parsing zls.json (#1002) 2023-02-15 13:34:52 -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
b28d3aadd7
Configuration handling fixes (#995)
* Fortify `server.handleConfiguration`.
* Move call to `server.registerCapability` within `server.initializedHandler`(was being sent prematurely).
2023-02-13 17:59:06 -05:00
nullptrdevs
409c203317
Amend getPositionContext to handle incomplete .string_literals, ie ", @" (#997) 2023-02-13 17:47:57 -05:00
Auguste Rame
7919da5054
Bump diffz to fix overflow issue on long files (#993) 2023-02-11 17:30:55 -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
Techatrix
99b5fd4f69 small refactor 2023-02-11 20:45:51 +01:00
Techatrix
654913ae47 implement coerceInMemoryAllowedErrorSets 2023-02-11 20:37:26 +01:00
Auguste Rame
bf19ed3ea9
Switch to Diff Match Patch (diffz) (#982)
* Add tests, note about correctness issue

* Use diffz (DiffMatchPatch)
2023-02-11 14:21:10 -05: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
Alex Kladov
0d3b0e9965
Remove some boilerplate from test (#988) 2023-02-11 14:19:37 -05:00
Techatrix
5754f362c6 Merge branch 'master' into intern-pool 2023-02-11 00:41:29 +01:00
Techatrix
6d387bca11 improve comptime interpreter dot completions 2023-02-11 00:34:30 +01:00
Techatrix
5cb0c98db1 fix function call resolution 2023-02-11 00:04:08 +01:00
Techatrix
3fda3b5414 remove some InternPool test boilerplate 2023-02-10 22:57:46 +01:00
Techatrix
09c35b8eaa update onePossibleValue for arrays 2023-02-10 22:44:26 +01:00
Techatrix
83f33f1c16 implement intInfo for enums 2023-02-10 19:39:21 +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
Techatrix
1b3274aa9c
simplify symbol references handler (#978) 2023-02-06 04:25:29 -05:00
nullptrdevs
62068ae828
zig build system changes (modules) (#976) 2023-02-05 02:15:42 -05:00
Techatrix
5a78cf1e50
optimize DocumentStore garbage collection (#969) 2023-02-05 00:24:37 -05:00
Techarix
66b7d7ad58 implement goto definition for cImport 2023-02-04 16:41:26 -08:00
Techarix
5f0d3bb886 show c source when hovering over cImport 2023-02-04 16:41:26 -08:00
nullptrdevs
bd539ae989
[std.zig.] parse(alloc, src) -> Ast.parse(alloc, src, Ast.Mode) (#966)
* Work in Zig's breaking changes (build sys apis)

* [`std.zig.`] `parse(alloc, src)` -> `Ast.parse(alloc, src, Ast.Mode)`
2023-02-04 18:19:24 +00:00
bing
384f227cb7
fix doc comment not showing on container field (#947) 2023-02-03 18:58:53 -05:00
nullptrdevs
4ba5631f7b
Update builtins data: "Say hello to @qualCast". (#962) 2023-02-03 18:05:24 -05:00
Techarix
5258a60f0e resolve bit size based target 2023-02-03 23:25:42 +01:00
Techarix
ef0cfadf8a Merge branch 'master' into intern-pool 2023-02-03 23:19:40 +01:00
nullptrdevs
6297536d7b
Work in Zig's breaking changes (build sys apis) (#955) 2023-02-03 17:06:57 -05:00
nullptrdevs
75f0617279
Skip incomplete fn_protos when generating folding ranges (#958) 2023-02-02 23:38:09 -05:00
Techatrix
1b3c3defb7
rewrite folding range (#954) 2023-02-01 18:29:36 -05:00
Techatrix
767cf7a52d
fix iterateChildren on if (#951) 2023-02-01 12:11:45 +00:00
Techatrix
7b3cc1d6d4
Optimize inlay hints (#948)
* optimize inlay hints

* update iterateChildren

* add tests for nodesAtLoc
2023-01-31 22:41:39 -05:00
Techatrix
eac61ba8be update data files 2023-01-28 22:42:13 +00:00
Techatrix
3080a5d315 fix config_gen 2023-01-28 22:42:13 +00:00
Techatrix
3c7e9e13ce better error messages on field access 2023-01-28 19:01:49 +01:00
Techatrix
9cde2495b2 bug fixes 2023-01-28 18:54:16 +01:00
Techatrix
32b70117ef use SegmentedList 2023-01-28 18:53:42 +01:00
Techatrix
55364f2e2b do not intern Structs, Enums and Unions 2023-01-28 18:02:29 +01:00
Techatrix
2857237f74
add colon to inlay hint label (#944) 2023-01-27 15:59:11 +01:00
Techatrix
e055f9d15c
remove unused capacity from Ast and DocumentStore (#941) 2023-01-26 16:57:07 -05:00
Techatrix
6019eff13e
Fuzzer fixes (#940)
* better handling of container_decl_arg_trailing

* ignore semantic token when moving backwards

* use custom ast functions instead of from std
2023-01-26 16:04:49 -05: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
b09c317ae7 bug hunting 2023-01-24 22:07:19 +01:00
Techatrix
d2586f79a1
replace ArrayList with MultiArrayList in DocumentScope (#938) 2023-01-24 15:43:48 -05:00
Techatrix
05ad3294f1 use ArrayList for dotCompletions 2023-01-24 17:00:14 +01:00
Techatrix
3577e719fb equality compare floats with bitcast in InternPool 2023-01-24 16:59:01 +01:00
Techatrix
95139e09ec move InternPool and encoding into analyser folder 2023-01-23 22:26:56 +01:00
Techatrix
829f4aa9c4 use analyser/completions.zig for completing comptime interpreter 2023-01-23 22:23:01 +01:00
Techatrix
4b7a434feb small refactor 2023-01-23 22:21:47 +01:00
Techatrix
497f1e1b23 implement field access in comptime interpreter 2023-01-23 21:29:24 +01:00
Techatrix
9dbae69288 add helper functions to intern pool 2023-01-23 21:28:40 +01:00
Techatrix
d10837dca0 expand dot completions 2023-01-23 21:28:15 +01:00
Álan Crístoffer
0e53ac1328
Partially fixes #907 (#908) 2023-01-22 17:52:04 -05:00
Techatrix
4e985e252b add struct value tests 2023-01-22 22:10:52 +01:00
Techatrix
0817d6008b redesign InternPool encoding 2023-01-22 21:59:30 +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
Techatrix
5afaf2ae3a
optimize folding range (#926) 2023-01-21 13:32:12 -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
1ed8d49b30
fix builtin completions if label_details_support is false (#924) 2023-01-20 19:33:27 -05:00
Techatrix
3085c3e153 implement big int 2023-01-20 22:39:19 +01:00
Techatrix
6d12c640ee add initial completions on InternPool 2023-01-20 22:24:39 +01:00
Techatrix
ba42fd2bb9 Merge branch 'master' into intern-pool 2023-01-20 22:23:44 +01:00
Techatrix
861e2ffb05 add formatting to recordError 2023-01-20 19:55:26 +01:00
Techatrix
1e73ac91e5 small comptime interpreter refactor 2023-01-20 19:28:25 +01:00
Techatrix
b4ac6142cf correctly resolve primitive types 2023-01-20 19:20:42 +01:00
Techatrix
34b2643b33 add basic comptime interpreter tests 2023-01-20 17:06:16 +01:00
Techatrix
06fcfcb3db add internpool to test steps 2023-01-20 17:04:59 +01:00
Techatrix
4a8fe90d23 add coerceInMemoryAllowed integer & float tests 2023-01-20 15:34:49 +01:00
Techatrix
a145dbb616 remove panics from release builds 2023-01-20 15:26:00 +01:00
Techatrix
3d95b203f2 coerce in memory improvements 2023-01-20 15:08:52 +01:00
Techatrix
bdf143eaa6 implement onePossibleValue 2023-01-20 15:08:08 +01:00
Techatrix
666e3b0e7c add function pointer peer type tests 2023-01-19 21:08:04 +01:00
Techatrix
5c20650143 refactor pointer peer type tests 2023-01-19 19:50:19 +01:00
Techatrix
eca9fc2f20 add expectEqualTypes 2023-01-19 19:49:46 +01:00
Techatrix
ea608a47ea peer type resolution improvements 2023-01-19 19:16:19 +01:00
Techatrix
1e3d9579ca improve peer type resolution test failure message 2023-01-19 19:15:52 +01:00
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