Commit Graph

654 Commits

Author SHA1 Message Date
pyxel
03f70be32a refactor: update ast with addrspace changes 2021-09-21 17:32:32 -04:00
Sashiri
6c39966967 Update zinput 2021-09-04 22:08:04 +02:00
Sashiri
fed1c4c2c6 usingnamespace semantics update
+ Ast changes adjustments
2021-09-04 21:25:35 +02:00
Lee Cannon
2ffd93280e remove deleted keywords 2021-08-30 13:54:27 +01:00
Sage Hane
5ddb92b865
Update "known-folders" submodule 2021-08-17 19:22:16 +09:00
Bodie Solomon
d25abb1055
Fix #372: catch up to zig master 05fd20dc 2021-08-09 12:14:20 -04:00
Auguste Rame
3172717af8 Update master data file 2021-07-27 11:15:02 -04:00
Alexandros Naskos
70cfba0eb9
Fixed unit tests 2021-07-10 20:05:16 +03:00
Alexandros Naskos
bba069526c
Fix build for zig master by inserting null terminators when tokenizing and resetting them when needed 2021-07-10 19:58:37 +03:00
Sizhe Zhao
86d49acdb0 Introducing new method of generating data files
A new file src/data/generate-data.py has been added.
It is written in Python 3 and has some new features like:
- It doesn't need Chrome to work, the script fetches the page automatically;
- It does the translation of HTML tags for better user experiences in editors.
In addition, a new section has been added to README.md to reflect this change.
2021-07-10 21:21:54 +08:00
Sizhe Zhao
14a70a38af Update master data 2021-07-09 23:45:48 +08:00
Sizhe Zhao
c3c4eb9c9d Update src/data/generate-data.js to translate code tags 2021-07-09 23:45:00 +08:00
Lee Cannon
62d287e518 Handle tag moved backwards without logging 2021-06-26 20:56:22 +01:00
Lee Cannon
7fb05da5a1 Update known-folders submodule 2021-06-24 12:31:35 +01:00
Lee Cannon
ac4b198869 Update to zig master
Redundant comptime, unused locals, unused function params, unused captures

As issue with @"type" resolving to the keyword type
2021-06-24 11:38:01 +01:00
Alexandros Naskos
bcfd7c6392
Merge pull request #344 from leecannon/per_build_config
Attempt at per build.zig config
2021-06-18 16:40:42 +03:00
Lee Cannon
154a2a8704 Add a per build.zig configuration file. 2021-06-18 13:22:37 +01:00
Lee Cannon
c2cbc05135 Fix index of of range 2021-06-18 12:58:15 +01:00
Alexandros Naskos
a02c1e7996
Build runner: Only output generated package path if it is available 2021-06-16 14:47:54 +03:00
Lee Cannon
1178ebd2e2
More changes to std.build :) 2021-06-15 21:15:55 +01:00
Lee Cannon
a077cf901d
Update build_runner.zig
I'm not 100% sure if the `GeneratedFile`'s path will have been resolved when this code runs or if this will hit the panic inside `getPath()` as I havent had a chance to actually mess about with the new functionality.
2021-06-12 23:06:48 +01:00
Alexandros Naskos
b756ed4da5
Fixed HashMap usage for latest master stdlib 2021-06-04 14:06:11 +03:00
Frank Denis
df9560db51 Update for -master
fn_proto.extern_export_token -> fn_proto.extern_export_inline_token

And update the data by the way.
2021-05-23 18:01:03 +02:00
Lee Cannon
584faec5de Call in build_runner 2021-05-13 21:29:05 +01:00
Alexandros Naskos
7fb7cdc36c
Fix std.testing.expectEqualStrings invocation for latest zig master build. 2021-05-13 17:53:53 +03:00
Alexandros Naskos
759a7b7fd9
No longer show completions for declarations in aggregate types when
field accessing instances of those types.
2021-05-08 19:30:22 +03:00
Alexandros Naskos
5631b8d202
Fix semantic token generation for container fields with a byte alignment 2021-05-08 19:11:26 +03:00
Alexandros Naskos
14dc9d1b51
Don't use the build runner path as the build runner cache path if present >.> 2021-05-08 18:48:36 +03:00
四光年
d4551030c4 [bug-fix]hover struct field not show docs. 2021-05-07 17:10:13 +08:00
Alexandros Naskos
937471d27b
Added --config-path option 2021-05-03 16:07:53 +03:00
Alexandros Naskos
91643c04c9
Fixed integer overflow in semantic_tokens.Builder.handleComments 2021-05-03 15:36:29 +03:00
Alexandros Naskos
ab8c65eeda
Fixed highlighting of comments before the first token and after the last token of the last valid AST node 2021-05-03 15:14:11 +03:00
Jonathan Hähne
e1c8e5d407 Undo stupidity & run zig fmt 2021-05-02 20:23:26 +02:00
Jonathan Hähne
807bd6a571 Simplify semantic_tokens, fix off-by-one error in identifierFromPosition 2021-05-02 19:59:17 +02:00
Ryan Roden-Corrent
ec34db0618
Fix small typo in comment. 2021-04-23 06:50:13 -04:00
Alexandros Naskos
23454e111c
Make semantic_tokens use @asyncCall instead of a stack again. 2021-04-19 17:17:46 +03:00
Jonathan Hähne
f61c9d8d4f Run zig fmt 2021-04-15 18:17:06 +02:00
Jonathan Hähne
b90c9b49ac Fix inclusion of toplevel doc comments, remove @async recursion in
writeNodeTokens, add a few regression tests
2021-04-15 11:07:43 +02:00
Jonathan Hähne
bb493c037a Add proper range check
Whoops
2021-04-07 17:26:50 +02:00
Jonathan Hähne
0b2d633e1e Support "catch" scopes 2021-04-07 15:42:33 +02:00
Jonathan Hähne
0e4f4c1e04 Improve testing infrastructure
It should now be a bit easier to set up a test and see how it failed.
2021-04-07 15:10:18 +02:00
Jonathan Hähne
b59db79a05 Refactor makeScopeInternal 2021-04-07 09:21:01 +02:00
Jonathan Hähne
45c7f9671c Merge some cases of resolveTypeOfNodeInternal 2021-04-06 18:38:17 +02:00
Alexandros Naskos
ea1ad532a2
More lastToken improvements 2021-04-06 17:16:50 +03:00
Alexandros Naskos
f6bc380b95
Fixed lastToken for fn_proto_multi nodes 2021-04-05 20:01:03 +03:00
Alexandros Naskos
6d13591d02
Merge branch 'master' of github.com:zigtools/zls 2021-04-05 19:45:12 +03:00
Alexandros Naskos
4b0d86f0bc
Fixed lastToken when called on function prototypes with no return type 2021-04-05 19:44:45 +03:00
Benjamin Tan
36ea1975bd
Standardize insertText to be above insertTextFormat 2021-04-05 22:27:56 +08:00
Benjamin Tan
33f03d36a5
completion: Add insertText field for enum completions
Another bug with the older version of lsp-mode on Emacs prevents the
label from being inserted when there is an empty `insertText`. This
commit adds an `insertText` property to enum completions for consistency
with the rest of the completion items.
2021-04-05 22:27:56 +08:00
Alexandros Naskos
902c91e98f
Pass the correct handle to hasSelfParam in bound type parameter evaluation code 2021-04-05 14:52:41 +03:00
Tau
b03fb5ffe3
Fix stack overflow and clean up a bit of resolveTypeOfNode (#297) 2021-04-05 14:46:05 +03:00
Alexandros Naskos
d397f1119e
Merge branch 'master' of github.com:zigtools/zls 2021-04-05 11:59:05 +03:00
Alexandros Naskos
2770321a61
Use a null filterText instead of an empty string by default 2021-04-05 11:58:41 +03:00
Tau
fc51dac30e
Fix stack overflow in resolveUse and int overflow in lookupSymbolGlobal 2021-04-05 01:35:33 +03:00
Alexandros Naskos
4bee4e662b
Made lookupGlobalSymbol start the search from the innermost scope that contains the source index 2021-04-04 15:28:57 +03:00
Alexandros Naskos
04372999aa
Fixed underflow in edgecase in getDocCommentTokenIndex 2021-04-04 02:12:57 +03:00
Tau
406214fb43
Fix stack overflow on missing return value & improve getDocCommentTokenIndex correctness (#290)
* Improve getDocCommentTokenIndex correctness
* Fix stack overflow on missing return value
2021-04-04 02:03:25 +03:00
Alexandros Naskos
42aefd2e67
Merge pull request #284 from zigtools/signature_help
Added signature help request handling.
2021-04-03 09:09:50 -07:00
Alexandros Naskos
cc3c146749
Correctly handle skipping self parameters in signature help requests
as well as completion requests.
2021-04-03 18:54:26 +03:00
Tau
28f2431b2e
Fix crash on Windows (#286)
* Fix crash on Windows
2021-04-03 12:14:52 +03:00
Alexandros Naskos
8d95218575
Resolve aliases when looking for the function prototype to generate
signature information.
Fixed doc comments in function signature information.
2021-04-03 02:53:41 +03:00
Alexandros Naskos
7f432d8715
Implemented the signature help request.
Refreshes builtin data, added 0.7.1 builtins
2021-04-02 20:49:01 +03:00
Alexandros Naskos
9cc8085699
Started signature help implementation 2021-04-01 14:20:37 +03:00
Alexandros Naskos
f45a934f50
Fixed for latest zig master 2021-04-01 14:19:02 +03:00
Tau
df22d2490b
Update zinput, known-folders and enable global configuration (#277) 2021-03-31 17:54:27 +03:00
Alexandros Naskos
5e8e14fc08
Correctly pass zig_exe_path to document_store initialization 2021-03-31 16:26:55 +03:00
Alexandros Naskos
cfae9b4d13
If the local configuration directory cannot be opened, zls config will now
fallback to opening the executable directory instead.
Added better error handling in zls config.
2021-03-31 14:46:56 +03:00
Alexandros Naskos
8cf6029f1a
Before documentPositionContext returns .empty, check if an identifier
immediately follows the cursor and return .var_access if it does
  instead.
This allows hover and go to definition to work when the cursor is
  immediately before an identifier.
2021-03-31 02:25:49 +03:00
Jonathan Hähne
443d5c77a7 Remove config target from build
The configuration is per-installation and has nothing to do with the
build.
2021-03-30 23:52:25 +02:00
Jonathan Hähne
2fc9506fdc Refactor config wizard
Deduplicated zig finder and added `zls config` subcommand
2021-03-30 23:52:25 +02:00
Alexandros Naskos
ba668094ad
Yet more import resolution fixes 2021-03-30 21:44:37 +03:00
Alexandros Naskos
6edd686668
Yet more import resolution fixes 2021-03-30 21:41:04 +03:00
Alexandros Naskos
40edfadc26
Fixed memory leak caused by DocumentStore.resolveImports 2021-03-30 21:18:46 +03:00
Alexandros Naskos
2415e7ca6d
Removed all zig.ast.Tree methods that call lastToken with our own versions 2021-03-30 20:59:58 +03:00
Alexandros Naskos
5a88f26980
Fixed dereference resolution of Type.data.pointer values 2021-03-30 16:45:49 +03:00
Alexandros Naskos
f382a1b22d
Better import handling 2021-03-30 15:41:59 +03:00
Jonathan Hähne
11a5d99c93 No stack frame capture for non-debug modes 2021-03-30 12:38:07 +02:00
Jonathan Hähne
b7cbb10610 Fix memory leaks
Closes #262.
2021-03-30 12:33:31 +02:00
Jonathan Hähne
c7158f7625 Remove checks again 2021-03-30 11:23:09 +02:00
Jonathan Hähne
83f153e87e Actually make it build (sem-token support has regressed previously!) 2021-03-30 11:07:29 +02:00
Jonathan Hähne
aab9ca18f2 Fix some crashes & find all @imports
If there are parse errors, an AST can contain uninitialized nodes.
Walking the tree in this case can lead to horribly nasty crashes.
2021-03-30 10:33:21 +02:00
Austin Clements
ec7ed30e65 Add check for semantic tokens client capability 2021-03-29 19:04:55 -05:00
Alexandros Naskos
b417e64e10
Do not show tests in container completions 2021-03-29 15:41:58 +03:00
Alexandros Naskos
bd3f0460ba
Merge pull request #267 from InterplanetaryEngineer/master
Accelerate symbolReferencesInternal further and improve refreshDocument algorithm
2021-03-29 05:38:46 -07:00
Alexandros Naskos
e770e2bead
Fixed regression from latest commit 2021-03-29 15:35:14 +03:00
Jonathan Hähne
ec1ee55dee Accelerate symbolReferencesInternal by another factor of 2 and activate unit tests 2021-03-29 14:08:38 +02:00
Jonathan Hähne
9a2695ecdb Improve refreshDocument algorithm
Do not use an arena, orderedRemove or bool array.

Also, rudimentary tests suggest the config parser does not account for
a substantial amount of the compile time.
2021-03-29 14:08:37 +02:00
Alexandros Naskos
962327425d
Fixed enum completion generation 2021-03-29 14:57:16 +03:00
Alexandros Naskos
4e753338af
Added error set and enum completion deduplication 2021-03-29 14:02:58 +03:00
Alexandros Naskos
360c437d6a
Some style fixes in analysis.zig 2021-03-29 13:01:24 +03:00
Alexandros Naskos
81500697db
Fixed crash in makeScopeInternal 2021-03-29 12:40:52 +03:00
Alexandros Naskos
2d168ed63e
Fixed error completion generation when making document scopes 2021-03-29 12:28:52 +03:00
Jonathan Hähne
826172edeb Improve textDocument/references performance
Filtering out documents in symbolReferences that do not @import the file
defining the symbol led to an order of magnitude speedup in the projects
that I tested.
2021-03-28 17:05:22 +02:00
Alexandros Naskos
48b5ca5385
Always send an insertText field in completion items 2021-03-28 17:02:48 +03:00
Jonathan Hähne
b33e26612a Add option to truncate long completions
The detail entries for big structs such as std.zig.CrossTarget were
bricking the preview window in Sublime Text.
2021-03-27 20:37:51 +01:00
Alexandros Naskos
3e300e4d74
Added our own ifFull implementation, fixes some crashes 2021-03-26 21:46:49 +02:00
Alexandros Naskos
9eece0985b
Fixed crash while typing error. 2021-03-26 21:14:47 +02:00
Alexandros Naskos
2fd8ab7626
Fixed error.<Foo> highlighting 2021-03-26 21:11:35 +02:00
Alexandros Naskos
06518778c1
Removed comment preprocessing code from the semantic tokens gap highlighter,
Fixed various comment semantic highlighting issues.
Refactored some minor parts of the analysis code.
2021-03-26 21:04:51 +02:00
Jonathan Hähne
a2620d7f69 Add option for builtin completion insert text 2021-03-26 10:20:20 +01:00
Alexandros Naskos
eb0a31d282
Reversed builtin completion insert text 2021-03-26 09:23:40 +02:00
Jonathan Hähne
8d34232c7a Fix completion of builtins and a piece of slightly overcomplicated logic 2021-03-24 22:40:15 +01:00
Alexandros Naskos
55ad1028fc
Fixed crash in analysis of variable declaration aliases 2021-03-21 02:31:32 +02:00
rhysd
6057d290b4 Fix falsy value for filterText and insertText
'filterText' and 'insertText' fields of 'CompletionItem' can only have
"" or undefined as falsy value.

https://github.com/microsoft/language-server-protocol/issues/1222
2021-03-15 20:20:38 +09:00
Luuk de Gram
472033a845
Improve token location stability 2021-03-13 12:22:19 +01:00
Auguste Rame
d5c46aef26
Merge pull request #245 from rhysd/error-msg-newlines
Add missing \n in error message output to stderr
2021-03-12 14:21:25 -05:00
Auguste Rame
2b488347ff
Merge pull request #238 from Luukdegram/std-fixes
Update to Zig std's new AST format
2021-03-12 12:57:03 -05:00
Luuk de Gram
0d85668ce4
Do not offer completion for function labels 2021-03-12 11:56:51 +01:00
Luuk de Gram
7a2cd418a8
Scope fixes + semantic token colors:
- Creates a scope for errdefer and adds the payload as a declaration
  (Previously lhs was a token index meaning we had an out of bounds error due too high of an integer)
- Semantic highlighting corrected for error payloads in loops/ifs and errdefers
2021-03-11 20:45:05 +01:00
Luuk de Gram
ef1b3c95f1
Completion fixes:
- Fixes namespace completions. Uses pointers instead of indices to ensure they are unique
- Adds .ptr completion to slices and `*` to many pointer
2021-03-11 13:59:09 +01:00
Luuk de Gram
094b31be48
Fix namespaces in containers 2021-03-10 17:04:14 +01:00
rhysd
addecb3a37 Add missing \n in error message output to stderr 2021-03-10 20:24:43 +09:00
Luuk de Gram
85937d48ca
Semantic token + scope fixes:
- Highlights pipes of loops/elses payloads correctly
- New ast structure counts last token as the variable itself and not the '}' so change scope checking to '<=' instead of '<'
2021-03-10 10:02:07 +01:00
Luuk de Gram
3ac6c82b9a
Completion for index label in for loops and fix for function snippets 2021-03-09 19:53:59 +01:00
Luuk de Gram
858f3cb282
Completion of unions in switches and its tags 2021-03-09 12:35:56 +01:00
Luuk de Gram
20cb0b7307
Fix off by one scope end index 2021-03-08 20:31:02 +01:00
Luuk de Gram
43ebfc7300
Work on completion for unwrapped slices/optionals in loops/ifs 2021-03-08 19:46:23 +01:00
Luuk de Gram
fd6b94bcc9
Fixes multiple small bugs:
- Correct completion based on scope
 - Semantic tokens for while/if/else/for keywords
 - Fix crash on import path
2021-03-07 21:54:54 +01:00
Luuk de Gram
a078a62a37
Semantic tokens: Allow for multiple line comments 2021-03-07 18:52:22 +01:00
Luuk de Gram
53c37765c0
Fix inferred error set return types 2021-03-07 18:45:37 +01:00
Luuk de Gram
e2f4bbf2f3
Implement semantic tokens for regular comments 2021-03-07 14:51:47 +01:00
Luuk de Gram
ac8a00342e
All functionalities implemented. Also implemented ability to skip searching for references through std 2021-03-06 20:55:59 +01:00
Luuk de Gram
3d8a9732fc
Calculate correct token locations and ensure all semantic highlighting matches 2021-03-05 22:38:42 +01:00
Luuk de Gram
acc45b4efe
Use the correct tree to display semantic tokens 2021-03-04 22:53:54 +01:00
Luuk de Gram
9224bbd4dc
Implement all of the semantic tokens 2021-03-04 22:30:25 +01:00
Luuk de Gram
08075a1261
Start fixing semantic tokens 2021-03-04 16:14:30 +01:00
Luuk de Gram
a80e9b262e
Implement usingnamespace and fix function snippets 2021-03-04 13:26:11 +01:00
Luuk de Gram
7495aab28b
Start implementing usingnamespace 2021-03-03 21:02:31 +01:00
Luuk de Gram
d7ccf6a3c2
References working for current file 2021-03-03 20:38:52 +01:00
Luuk de Gram
a699dab2f7
Referencing fixes and more 2021-03-03 16:34:24 +01:00
Frank Denis
3431b7afaa Regen data for master - @TagType is gone 2021-03-03 13:46:23 +01:00
Luuk de Gram
92adeb8826
Completion fixes 2021-03-02 22:01:13 +01:00
Luuk de Gram
1dd39914ec
Hovering fixes 2021-03-02 15:32:38 +01:00
Luuk de Gram
c8a2467fac
Compiles without errors. Still needs improvement 2021-03-01 22:18:38 +01:00
Luuk de Gram
ada0d13ba9
Fix symbolReferencesInternal 2021-03-01 19:34:28 +01:00
Luuk de Gram
e82ea30e6f
Last fixes in src/analysis.zig 2021-03-01 16:30:43 +01:00
Luuk de Gram
4645638434
Fixes and completions 2021-03-01 16:02:24 +01:00
Luuk de Gram
1c9da7053c
More type resolving 2021-03-01 14:32:19 +01:00
Luuk de Gram
b651a79380
Type resolving fixes 2021-02-28 21:57:15 +01:00
Luuk de Gram
96fcac89a4
Complete resolveTypeOfNodeInternal 2021-02-28 20:37:21 +01:00
Luuk de Gram
b175a01fce
Progress in resolveTypeOfNodeInternal 2021-02-28 17:42:34 +01:00
Luuk de Gram
709c1a70fd
Implement makeScopeInternal logic 2021-02-28 13:09:10 +01:00
Luuk de Gram
5f5d6ce4ea
Progress in makeScopeInternal 2021-02-27 21:55:39 +01:00
Luuk de Gram
72605c7549
A lot of fixes 2021-02-27 16:38:06 +01:00
Luuk de Gram
0133f0d863
First set of changes to work with new std's ast 2021-02-26 21:26:52 +01:00
Alexandros Naskos
a886ecddd9
Fixed for zig master 2021-02-15 12:04:22 +02:00
Alexandros Naskos
fa496936f5
Always find the closest existing candidate build file before looking in the directory structure 2021-01-31 12:35:08 +02:00
Alexandros Naskos
ca6598572e
Reworked the build file searching method
Instead of looking for any existing build file in the store that fits
  in the directory structure of a new document, we now always look
  for the closest build.zig file in the directory structure.
2021-01-31 12:24:55 +02:00
Alexandros Naskos
c98c44460c
Fixed session tests 2021-01-28 11:20:13 +02:00
S0urc3C0de
acab137c99 Update to latest zig.
Fix change for changing zig.ast name attribute to be optional.
2021-01-27 21:53:02 +01:00