Commit Graph

708 Commits

Author SHA1 Message Date
Mikhail Modin
b150965ed7 Swtches to rust SSR query check 2020-03-15 21:23:18 +00:00
Veetaha
5e32a67c83 vscode-postrefactor: more logging and better error handling 2020-03-14 03:01:14 +02:00
Veetaha
d7b46e0527 vscode-postrefactor: enforcing more reentrancy 2020-03-14 02:01:46 +02:00
Veetaha
7f02d4657b vscode-postrefactor: minor config refactorings 2020-03-14 02:01:46 +02:00
Veetaha
607d017229 vscode-postrefactor: unhandled promise rejections shall not pass 2 2020-03-14 02:01:46 +02:00
Veetaha
c2b0fffe3d vscode-postrefactor: add achtung comment 2020-03-14 02:01:46 +02:00
Veetaha
abee777b6e vscode-postrefactor: remove remainders of debug logging 2020-03-14 02:01:46 +02:00
Veetaha
028a4aa99f vscode-postrefactor: unhandled promise rejections shall not pass 2020-03-14 02:01:46 +02:00
Veetaha
b0bf495262 vscode-postrefactor: compare dates by value, not by reference 2020-03-14 02:01:46 +02:00
Veetaha
c3ee8b10b8 vscode-postrefactor: eliminate my-mistake floating promise @matklad 2020-03-14 02:01:46 +02:00
Veetaha
bc87d6de86 vscode-postrefactor: global storages 2020-03-14 02:01:46 +02:00
Veetaha
77a206e0b2 vscode: put comma back 2020-03-14 02:01:46 +02:00
Veetaha
4d17152b31 vscode: make bailing out on custom serverPath more evident 2020-03-14 02:01:46 +02:00
Veetaha
7e6b1a60c3 vscode: npm run fix 2020-03-14 02:01:46 +02:00
Veetaha
1e73811fbe vscode: amend server installation logic to account for nightlies 2020-03-14 02:01:46 +02:00
Veetaha
601fc9d1ab vscode: add nightly extension installation logic 2020-03-14 02:01:46 +02:00
Veetaha
6d2d753677 vscode: prepare config for nightlies 2020-03-14 02:01:46 +02:00
Veetaha
0f826aec82 vscode: get release date from release info 2020-03-14 02:01:46 +02:00
Veetaha
98b2a942d1 vscode-prerefactor: add some utility functions 2020-03-14 02:01:46 +02:00
Veetaha
8203828bb0 vscode-prerefactor: merge two files into downloads.ts 2020-03-14 02:01:46 +02:00
bors[bot]
4c85e53531
Merge #3561 #3577
3561: feat: add debug code lens r=matklad a=hdevalke

Refs #3539

3577: Protect against infinite macro expansion in def collector r=edwin0cheng a=flodiebold

Something I noticed while trying to make macro expansion more resilient against errors.

There was a test for this, but it wasn't actually working because the first recursive expansion failed. (The comma...)

Even with this limit, that test (when fixed) still takes some time to pass because of the exponential growth of the expansions, so I disabled it and added a different one without growth.

CC @edwin0cheng 

Co-authored-by: Hannes De Valkeneer <hannes@de-valkeneer.be>
Co-authored-by: hdevalke <2261239+hdevalke@users.noreply.github.com>
Co-authored-by: Florian Diebold <florian.diebold@freiheit.com>
2020-03-13 14:01:29 +00:00
hdevalke
fa655912b5
Update editors/code/src/config.ts
Co-Authored-By: Veetaha <veetaha2@gmail.com>
2020-03-12 22:56:37 +01:00
Hannes De Valkeneer
39c92b3872 fixup! feat: add debug code lens
autodetect vscode-lldb
2020-03-12 22:31:47 +01:00
Hannes De Valkeneer
e9d025b618 fixup! feat: add debug code lens
avoid repetition of `--no-run`
2020-03-12 21:28:26 +01:00
Hannes De Valkeneer
a034257e5e fixup! feat: add debug code lens 2020-03-12 21:00:40 +01:00
Aleksey Kladov
b3fa7312a7 Simpler deserialization 2020-03-12 18:01:36 +01:00
bors[bot]
d98a5fab46
Merge #3543
3543: Parameter inlay hint separate from variable type inlay? #2876 r=matklad a=slyngbaek

Add setting to allow enabling either type inlay hints or parameter
inlay hints or both. Group the the max inlay hint length option
into the object.

- Add a new type for the inlayHint options.
- Add tests to ensure the inlays don't happen on the server side

Co-authored-by: Steffen Lyngbaek <steffenlyngbaek@gmail.com>
2020-03-12 16:02:55 +00:00
Steffen Lyngbaek
a153b90875 Make maxLength nullable again 2020-03-12 08:43:07 -07:00
Steffen Lyngbaek
58248e24cd Switch from Vec<InlayKind> to object with props
- Instead of a single object type, use several individual nested types
  to allow toggling from the settings GUI
- Remove unused struct definitions
- Install and test that the toggles work
2020-03-11 20:14:39 -07:00
Hannes De Valkeneer
e903fd0d97 feat: add debug code lens
Refs #3539
2020-03-11 22:26:47 +01:00
Steffen Lyngbaek
cfb48df149 Address Issues from Github
- Updated naming of config
- Define struct in ra_ide and use remote derive in rust-analyzer/config
- Make inlayConfig type more flexible to support more future types
- Remove constructor only used in tests
2020-03-10 14:36:01 -07:00
Steffen Lyngbaek
e98aff109a Parameter inlay hint separate from variable type inlay? #2876
Add setting to allow enabling either type inlay hints or parameter
inlay hints or both. Group the the max inlay hint length option
into the object.

- Add a new type for the inlayHint options.
- Add tests to ensure the inlays don't happen on the server side
2020-03-10 14:33:45 -07:00
Edwin Cheng
c1db5d26a0 Add additional_outdirs in config 2020-03-11 01:06:01 +08:00
Veetaha
ce65cc949f vscode: groupd updates-related config under updates section as per @matklad 2020-03-09 10:59:36 +02:00
Veetaha
de99fa7199 vscode: fix inversion of askBeforeDownload 2020-03-08 21:47:35 +02:00
Veetaha
6bd1ff16e5 vscode: rename alwaysDownloadServer -> askBeforeDownload
The new name seems much simpler and it doesn't limit
this config value only to downloading the server binary.
Thus we wouldn't need to create another config
properties to handle other downloads whatsoever.
Anyway, I believe (heuristically) that most of the users
would want to set "askBeforeDownload": false once
and never bother clicking on the notification again
(because otherwise there is no big point in installing rust-analyzer if it cannot install the server)
2020-03-08 18:58:02 +02:00
Veetaha
c29a502e25 vscode: care about alwaysDownloadServer option before asking
Also renamed BinarySource to ArtifactSource in anticipation of
nightlies installation that requires downloading
not a binary itself but .vsix package, thus generalized
to `artifact` term
2020-03-08 00:01:48 +02:00
Veetaha
65cecff316 vscode: post refactor HintsUpdater (simplify create() -> constructor call) 2020-03-07 14:39:42 +02:00
Veetaha
61a4ea2532 vscode: more privacy for HintsUpdater 2020-03-07 14:37:15 +02:00
Veetaha
2734ffa20c vscode: remove logging from inlays, run fix lint issues 2020-03-07 14:34:09 +02:00
Veetaha
ef52fd543f vscode: remove logic for caching editors as per @matklad 2020-03-07 14:08:35 +02:00
Veetaha
a63446f254 vscode: prerefactor util.ts and ctx.ts 2020-03-07 14:08:35 +02:00
Veetaha
3d93e2108e vscode: refresh all editors on text changes, simplify inlays api 2020-03-07 14:08:35 +02:00
Veetaha
057cd959da vscode: add dat semicolon 2020-03-07 14:08:35 +02:00
Veetaha
fd709c0c04 vscode: simpify 2020-03-07 14:08:35 +02:00
Veetaha
6441988d84 vscode: redesign inlay hints to be capable of handling multiple editors 2020-03-07 14:08:35 +02:00
Veetaha
0e6d066a29 vscode: extract Type and Param hint cases of InlayHint at type level (needed further) 2020-03-07 14:08:35 +02:00
bors[bot]
b55d22e060
Merge #3388
3388: Remove inlay hint in diff views r=matklad a=vbfox

If the left side of a diff view that contain the old version of the file apply inlays they are misplaced and produce a weird display:

![image](https://user-images.githubusercontent.com/131878/75628802-b1ac1900-5bdc-11ea-8c26-6722d8e38371.png)

After the change:

![image](https://user-images.githubusercontent.com/131878/75628831-e91ac580-5bdc-11ea-9039-c6b4ffbdb2be.png)

The detection is done by blacklisting the url schemes used by git and subversion scm extensions, whitelisting `file` is also possible but neither is perfect as VSCode now support both pluggable scm extensions and pluggable remote filesystems. But I suspect that the list of scm extensions is more easily manageable.

**Note**: I can rebase on #3378 if needed as it touches the same lines of code

Co-authored-by: Julien Roncaglia <julien@roncaglia.fr>
2020-03-03 13:45:26 +00:00
Julien Roncaglia
2f54c1d653 Centralize the check for languageId on document
Also move visibleRustEditors to Ctx
2020-03-02 22:54:29 +01:00
Aleksey Kladov
dbd1698e02 Don't fail loudly if the old highlighting breaks 2020-03-02 14:46:46 +01:00
Julien Roncaglia
b95756d21b Remove inlay in diff views
If the left side of a diff view that contain the old
version of the file apply inlays they are misplaced.

The detection is done by blacklisting the url schemes used
by git and subversion scm extensions.
2020-03-01 16:54:56 +01:00
Veetaha
6dc598fa63 vscode: simplify assert.eq() to assert() as per matklad 2020-02-29 00:59:42 +02:00
Veetaha
e7bf99e6fd vscode: add dat semicolon 2020-02-29 00:33:34 +02:00
Veetaha
3ad0574d7e vscode: add equality assertion 2020-02-29 00:26:22 +02:00
Veetaha
9cf2577054 vscode: rename nodeAssert -> nativeAssert 2020-02-29 00:07:29 +02:00
Veetaha
b88887e70e vscode: add error loging on failed assertion 2020-02-29 00:02:19 +02:00
Veetaha
1b9ab04d4b vscode: migrate to more type-safe assert impl 2020-02-28 23:56:17 +02:00
Aleksey Kladov
84b009cbf7 Reset fontStyle for inlay hints
Otherwise, we get bold hints on `true` and `false`
2020-02-28 11:31:53 +01:00
Aleksey Kladov
cfa5afa02d Fix lint 2020-02-27 10:46:43 +01:00
Aleksey Kladov
b49508ffe3 Fix flickering with new syntax highlighting 2020-02-27 10:19:56 +01:00
Aleksey Kladov
225ef6dea2 Config to switch to semantic tokens 2020-02-26 16:03:30 +01:00
Aleksey Kladov
8c0d0894b6
Merge pull request #3321 from kjeremy/semantic-client
Enable SemanticTokens on the client
2020-02-26 15:59:30 +01:00
Jeremy Kolb
74125d012e Enable SemanticTokens on the client
This will crash the extension on stable and insiders without the "--enable-proposed-api matklad.rust-analyzer" command line switch.
2020-02-26 08:42:26 -05:00
Aleksey Kladov
1f1bda2c5a Remove unnecessary dep 2020-02-26 14:21:23 +01:00
bors[bot]
c4c15363fb
Merge #3295
3295: Refactoring fetchArtifactReleaseInfo() r=matklad a=Veetaha

https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-unnecessary-type-assertion.md

I fact this rule doesn't work when you put an unnecessary non-null assertion in an expression (as we had `(awat f())!`, but it is useful in other cases...

Closes #3295, i guess...

Co-authored-by: Veetaha <gerzoh1@gmail.com>
2020-02-25 10:09:14 +00:00
Veetaha
6ec4a7db42 vscode: wrap non-single-line if body with curlies as per matklad 2020-02-25 01:58:43 +02:00
Veetaha
18b97d9d36 vscode: migrate rust-analyzer-api to import * as lc as per matklad and kjeremy 2020-02-25 01:43:52 +02:00
Veetaha
72e81dae71 vscode: run fmt 2020-02-25 01:00:00 +02:00
Veetaha
c9230b88b4 vscode: migrate inlay_hints to rust-analyzer-api.ts 2020-02-25 00:57:49 +02:00
Veetaha
8aea0ec511 vscode: migrate syntax_tree to rust-analyzer-api.ts 2020-02-25 00:57:14 +02:00
Veetaha
9ea63d5a86 vscode: migrate ssr to rust-analyzer-api.ts 2020-02-25 00:56:57 +02:00
Veetaha
8a8a4d08ef vscode: migrate runnables to rust-analyzer-api.ts 2020-02-25 00:56:38 +02:00
Veetaha
d6a96a90f4 vscode: migrate parent_module to rust-analyzer-api.ts 2020-02-25 00:56:19 +02:00
Veetaha
8c6581dcc3 vscode: migrate on_enter to rust-analyzer-api.ts 2020-02-25 00:55:48 +02:00
Veetaha
56d1ff6532 vscode: migrate matching_brace to rust-analyzer-api.ts 2020-02-25 00:55:13 +02:00
Veetaha
38d7945ec7 vscode: migrate join_lines to rust-analyzer-api.ts 2020-02-25 00:54:50 +02:00
Veetaha
c9a2fa1835 vscode: migrate collectGarbage to rust-analyzer-api.ts 2020-02-25 00:50:57 +02:00
Veetaha
31d9932d18 vscode: migrate expand_macro to rust-analyzer-api.ts 2020-02-25 00:50:36 +02:00
Veetaha
603bc71a57 vscode: migrate analyzer_status to rust-analyzer-api.ts 2020-02-25 00:50:14 +02:00
Veetaha
8c4409b3bb vscode: migrate highlighting to rust-analyzer-api.ts 2020-02-25 00:49:54 +02:00
Veetaha
21ab133966 vscode: migrate source_cnage.rs to rust-analyzer-api.rs 2020-02-25 00:49:19 +02:00
Veetaha
39efb301ff vscode: create rust-analyzer-api.ts 2020-02-25 00:48:44 +02:00
Veetaha
af57251c31 vscode: remove type assertion 2020-02-24 21:23:56 +02:00
Veetaha
b4db089a6b add error handling to fetchArtifactReleaseInfo(), throw Error when no artifact found 2020-02-24 21:13:10 +02:00
Aleksey Kladov
cc1469fe9e Cleanp 2020-02-24 15:41:13 +01:00
bors[bot]
e2a8e891c1
Merge #3290
3290: Don't block onEnter if request fails r=matklad a=matklad

closes #3286



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-02-24 11:48:15 +00:00
Aleksey Kladov
910adb9dc7 Don't block onEnter if request fails
closes #3286
2020-02-24 12:45:34 +01:00
bors[bot]
223a6676fd
Merge #3288
3288: Quick fix circular json error when sanity-check fails r=matklad a=Veetaha

Related issue: #3280

Co-authored-by: Veetaha <gerzoh1@gmail.com>
2020-02-24 11:40:06 +00:00
Aleksey Kladov
b12cbd6062 Don't break onEnter if rust-analyzer fails to start
closes #3253
2020-02-24 12:32:15 +01:00
Veetaha
ef4dfab3cc
Quick fix circular json error when sanity-check fails
Related issue: #3280
2020-02-24 11:56:52 +02:00
Veetaha
4cee7cddc8 vscode: gracefully handle cancellation errors 2020-02-23 15:49:09 +02:00
Aleksey Kladov
49844ab717 Extract client-side logging 2020-02-22 16:03:47 +01:00
Veetaha
d905abfb11 vscode: migrate to tripple equals 2020-02-22 13:46:11 +02:00
Edwin Cheng
319a09847b Use stdout directly 2020-02-21 18:33:45 +08:00
Edwin Cheng
489be40d3a Use ensureServerBinary instead 2020-02-21 18:33:45 +08:00
Edwin Cheng
e7a0d8f8d0 Add trailing newline 2020-02-21 18:33:45 +08:00
Edwin Cheng
4e48a73f9c Improve server version info 2020-02-21 18:33:45 +08:00
Aleksey Kladov
28bf731751 enforce camel case 2020-02-21 11:22:45 +01:00
eaglgenes101
358b9d685f Improved compatibility with themes 2020-02-20 12:40:12 -05:00
Aleksey Kladov
742459c8fe
Merge pull request #3204 from Veetaha/feature/vscode-remove-updates-notification-comment
vscode: remove comment about updates notification
2020-02-18 13:44:56 +01:00
Aleksey Kladov
c855e36696 Rename config value for server Path 2020-02-18 12:35:44 +01:00
Aleksey Kladov
c0fa5e2246 Rename the binary to rust-analyzer 2020-02-18 12:33:16 +01:00
Aleksey Kladov
07a77ffb35 Migrate to eslint 2020-02-17 23:42:25 +01:00
Veetaha
765852a444 vscode: remove comment about updates notification 2020-02-17 22:19:00 +02:00
Veetaha
7379964048 vscode: press ; to respect semicolons 2020-02-17 22:09:44 +02:00
Aleksey Kladov
3717b0e03f Simplify some more ctors 2020-02-17 14:23:23 +01:00
Aleksey Kladov
3c12cd49ec Simplify ctor 2020-02-17 14:22:09 +01:00
Aleksey Kladov
7dccfd9183 remove debug print 2020-02-17 14:20:18 +01:00
Aleksey Kladov
89afb1a841 Remove two stage constuction 2020-02-17 14:11:01 +01:00
Aleksey Kladov
978bea2b31 Fix link to the manual 2020-02-17 14:04:32 +01:00
Aleksey Kladov
ee4e41cbea Push IO and error handling up 2020-02-17 14:03:33 +01:00
Aleksey Kladov
d24e612106 Simplify startup 2020-02-17 13:40:47 +01:00
Aleksey Kladov
dcdbbddd16 Simplify TS reload logic
Fixes #3164
2020-02-17 13:40:47 +01:00
bors[bot]
93d28fb50c
Merge #3099
3099: Init implementation of structural search replace r=matklad a=mikhail-m1

next steps:
* ignore space and other minor difference
* add support to ra_cli
* call rust parser to check pattern
* documentation

original issue #2267 

Co-authored-by: Mikhail Modin <mikhailm1@gmail.com>
2020-02-17 10:02:54 +00:00
bors[bot]
953dbe3e02
Merge #3181
3181: Add ability to pass additional arguments to rustfmt. r=matklad a=Leonqn

relates to #2848

Co-authored-by: Ilya Titkov <ilya@titkov.me>
2020-02-17 09:05:01 +00:00
Ilya Titkov
a2b0bdcc24 Add arguments to rustfmt 2020-02-17 11:44:58 +03:00
Veetaha
bd113623a0 vscode: minor refactorings 2020-02-17 02:07:11 +02:00
Veetaha
31ae646448 vscode: add comment on possible UnhandledPromise rejection error 2020-02-17 01:39:58 +02:00
Veetaha
6e22e33d7d vscode: fix stupid mistake 2020-02-16 19:30:13 +02:00
bors[bot]
a15c8739b9
Merge #3162
3162: Feature: vscode always downloads only the matching ra_lsp_server version r=matklad a=Veetaha

I tried to separate logically connected changes into separate commits, so enjoy!

Now TypeScript extension saves installed binary version in global state and always checks that the installed binary version equals the version of the TypeScript extension itself (to prevent version drifts).
Also, changed `fetchLatestArtifactReleaseInfo()` to `fetchArtifactReleaseInfo()` that takes an optional release tag (when not specified fetches the latest release). The version without a release tag will be useful in the future when adding auto-checking for updates.

I decided not to do `Download latest language server` command (I have stated the rationale for this in #3073) and let the extension itself decide which version of the binary it wants. This way the users will be able to get the latest `ra_lsp_server` binary after the approaching 2020-02-17 release, without having to manually delete the outdated one from `~/.config/Code/User/globalStorage/matklad.rust-analyzer`!

Closes #3073

Co-authored-by: Veetaha <gerzoh1@gmail.com>
2020-02-16 11:54:38 +00:00
Veetaha
3068aab82d vscode: fix the default value for withSysroot 2020-02-16 11:15:19 +02:00
Veetaha
467b925b53 vscode: save binary version when downloading and download only version that matches TypeScript extension version 2020-02-16 03:41:40 +02:00
Veetaha
b9188226fa vscode: extract downloadArtifact() function 2020-02-16 03:41:40 +02:00
Veetaha
0f7abeb035 vscode: add release tag option to fetchArtifactReleaseInfo() 2020-02-16 03:41:40 +02:00
Veetaha
8533fc437b vscode: add version and storage parameters to github binary source 2020-02-16 03:41:39 +02:00
Veetaha
80d5ba68da vscode: renamed langServer to server 2020-02-15 00:42:32 +02:00
Veetaha
f61134e198 vscode: renmed ArtifactMetadata -> ArtifactReleaseInfo, languageServer -> langServer 2020-02-15 00:15:06 +02:00
Mikhail Modin
f8f454ab5c Init implementation of structural search replace 2020-02-14 21:45:42 +00:00
bors[bot]
ab42174653
Merge #3131
3131: vscode: simplified config and to removed one source of truth of default values r=matklad a=Veetaha

Though not intended initially, the implementation of config design is alike [dart's one](https://github.com/Dart-Code/Dart-Code/blob/master/src/extension/config.ts) as pointed by @matklad in PM.

Co-authored-by: Veetaha <gerzoh1@gmail.com>
2020-02-14 21:08:47 +00:00
Veetaha
20fabaf1ee make onConfigChange handler private 2020-02-14 23:06:11 +02:00
Veetaha
4fb427743c vscode: moved to getters as per matklad 2020-02-14 23:04:50 +02:00
kjeremy
7a832cdf6b Do not register all proposed features
Instead only opt-in to CallHierarchy since it has a vscode API but LSP support
is still proposed.

Discovered while working on SemanticTokens which does not have a vscode API
and is still in the proposed state. Somehow enabling it would crash the
language server.

See https://github.com/microsoft/vscode-languageserver-node/issues/572
2020-02-14 11:48:27 -05:00
Veetaha
574dc11a2f vscode: removed nested errors as per matklad 2020-02-14 00:33:12 +02:00
Veetaha
fd37151ade vscode: reordered config constructor before methods 2020-02-13 23:05:32 +02:00
Veetaha
7ad15c3962 vscode: redesigned config with simplicity and Dart extension config implementation in mind 2020-02-13 22:48:20 +02:00
Veetaha
da6ae3b6e0 vscode: replaced DownloadFileError with NestedError itself for simplicity 2020-02-13 22:21:19 +02:00
Veetaha
a3febc1c57 vscode: switched to stream.pipeline with .on(close) workaround 2020-02-12 21:40:35 +02:00
Veetaha
36dc3edb7a vscode: added error handling to download file streams 2020-02-11 23:58:48 +02:00
Veetaha
b834b37682 vscode: remove chmod in favour of an option to createWriteStream() 2020-02-11 22:34:52 +02:00
bors[bot]
f55d74dc0d
Merge #3083 #3101
3083: Update some crates r=matklad a=kjeremy



3101: vscode: filter out arm linux from using prebuilt binaries r=matklad a=Veetaha

Closes #3076

Co-authored-by: kjeremy <kjeremy@gmail.com>
Co-authored-by: Veetaha <gerzoh1@gmail.com>
2020-02-11 09:32:32 +00:00
bors[bot]
98aa709fa7
Merge #3100
3100: vscode: add error handling to downloadFile() r=matklad a=Veetaha

Inspired by #3094.

Co-authored-by: Veetaha <gerzoh1@gmail.com>
2020-02-11 09:25:31 +00:00
Veetaha
2344dac183 vscode: filter out arm linux from using prebuilt binaries 2020-02-11 02:29:11 +02:00
Veetaha
f2c66605c2 vscode: add error handling to downloadFile() 2020-02-11 02:14:04 +02:00
Veetaha
78ee964f7c vscode: fix ebusy error on windows 2020-02-10 23:12:20 +02:00
Veetaha
e709f113c1 vscode: changed dns sanity-check url from google.com to example.com 2020-02-09 22:27:01 +02:00
Veetaha
5d39f6d3b2 vscode: add on-success logic to dns resolution sanity check 2020-02-09 22:00:33 +02:00
Veetaha
fa7b91a2f7 vscode: removed unnecessary awaits 2020-02-09 21:55:29 +02:00
Veetaha
7cba77ed4e vscode: added logging when donloading binaries 2020-02-09 15:01:00 +02:00
Veetaha
f3240e22c6 vscode: move throtting of download progress to call site 2020-02-09 14:18:05 +02:00
Veetaha
a63659badb vscode: replaced unwrapNotNil() with ! as per @matklad 2020-02-09 13:59:27 +02:00
Veetaha
7a09274e52 vscode: refactor inverted ternaries to if statements as per @matklad 2020-02-09 13:45:06 +02:00
Veetaha
34241b9af9 vscode: remove noise data fields declarations as per @matklad 2020-02-09 13:39:54 +02:00
Veetaha
3159e87c49 vscode: refactor levels of code nesting and string literals quotes 2020-02-09 13:36:36 +02:00
Veetaha
a3e3fba7bf
vscode: fix chmod to octal literal
Co-Authored-By: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-02-09 12:54:51 +02:00
Veetaha
d08ae7e82f vscode: minor names and message contents changes 2020-02-09 00:58:53 +02:00
Veetaha
fd6a98ef6e vscode: rename raLspServer variable to langServer 2020-02-09 00:42:51 +02:00
Veetaha
8f291c0089 vscode: refactor comment 2020-02-09 00:28:32 +02:00
Veetaha
539daf4454 vscode: refactor platform artifact name query to switch statement, move BinarySource union variants into a namespace 2020-02-09 00:27:04 +02:00
Veetaha
bdd88c2fad vscode: reduce throttle latency of downloadFile() progress callback for smoother UX 2020-02-08 21:25:03 +02:00
Veetaha
9791b6a8de vscode: add name to the second unused argument of withProgress() callback 2020-02-08 21:24:29 +02:00
Veetaha
4e85254444 vscode: add docs to installation module interfaces and sanity check to donloadFile() 2020-02-08 21:03:27 +02:00
Veetaha
6ef912f925 vscode: converted fetchLatestArtifactMetadata params to positional, added docs 2020-02-08 20:18:33 +02:00
Veetaha
f7ef72db64 vscode: changed chmod value to 755 as per @lnicola 2020-02-08 20:07:00 +02:00
Veetaha
5d88c1db38 vscode: amended config to use binary from globalStoragePath, added ui for downloading 2020-02-08 04:34:11 +02:00
Veetaha
3e0e4e90ae added fetchLatestArtifactMetadata() and downloadFile() functions 2020-02-08 04:34:11 +02:00
Veetaha
1bdb78a89f vscode: add FIXME about language client shared resource protection 2020-02-08 04:34:11 +02:00
bors[bot]
ea9d18ba83
Merge #3024
3024: vscode: eliminate floating promises and insane amount of resource handle leaks r=matklad a=Veetaha

Khm, yeah ...

Co-authored-by: Veetaha <gerzoh1@gmail.com>
2020-02-05 20:57:08 +00:00
Veetaha
8153b60e1d vscode: eliminate floating promises and insane amount of resource handle leaks 2020-02-05 22:39:47 +02:00
Veetaha
b89b22e43e vscode: yet another refactor commit 2020-02-05 00:13:46 +02:00
Grégoire Geis
875dc6d1a4
Merge two if statements into one in editors/code/src/commands/on_enter.ts.
Co-Authored-By: Veetaha <veetaha2@gmail.com>
2020-02-04 01:44:12 +01:00
Gregoire Geis
b70ad7e5f3 Remove enableEnhancedTyping and type overriding infrastructure. 2020-02-03 20:24:50 +01:00
Gregoire Geis
23ef22dd48 Add regular onEnter command, allowing onEnter to be called without overriding the type command. 2020-02-03 20:18:10 +01:00
Aleksey Kladov
ad57726f91 Use simple prng instead of a dependency
closes #2999
2020-02-03 16:37:12 +01:00
Veetaha
2fd7af2a62 vscode: use void where possible 2020-02-02 23:24:09 +02:00
Veetaha
5411d65a7f vscode: fix, fallback to any for cmd type 2020-02-02 22:36:12 +02:00
Veetaha
12d0970f7e vscode extension: migrate from any to unknown where possible 2020-02-02 22:19:59 +02:00
Veetaha
4bf5f59560 vscode: fix type 2020-02-02 21:38:49 +02:00
Veetaha
8184752470 vscode refactoring: use more laconic export snytax, split huge string to several lines 2020-02-02 21:37:22 +02:00
Veetaha
420462421d vscode extension cleanup: migrate to prefer-const tslint rule 2020-02-02 21:12:59 +02:00
bors[bot]
3f499489f7
Merge #2964
2964: Improve responsiveness of the cargo check status label r=matklad a=lnicola

This is still not ideal because the label displays the crate that was just checked, not the one that's currently being checked. But it should give the impression of being faster.

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2020-02-01 15:41:55 +00:00
bjorn3
c84897bfb7 Tsfmt 2020-02-01 13:41:11 +01:00
bjorn3
5c39311f96 Fix seedrandom in packaged extension
Fixes #2971
2020-02-01 13:39:04 +01:00
bjorn3
f4431d2acc [VSCode] Fix syntax highlighting
Fixes #2969
2020-02-01 13:12:39 +01:00
Laurențiu Nicola
d4d72e8b9b Improve responsiveness of the cargo check status label 2020-01-31 20:55:10 +02:00
Aleksey Kladov
94784cc546 Provide better diagnostics if the server is not in path 2020-01-28 17:00:00 +01:00
Kirill Bulatov
78a21253b4 Apply the api design suggestions 2020-01-15 20:17:17 +02:00
Kirill Bulatov
73dc8b6f06 Another attempt to add multiple edits 2020-01-15 20:16:27 +02:00
Emil Lauridsen
70cba0fe0f Use types from vscode-langaugeclient 2020-01-15 12:04:35 +01:00
bors[bot]
876f92d547
Merge #2843
2843: Add inlay parameter name hints for call expr r=matklad a=imtsuki

This patch adds Intellij-like parameter name hints for literal values in function calls.

<img width="624" alt="Screenshot" src="https://user-images.githubusercontent.com/8423594/72366533-68d7f800-3735-11ea-9279-cf193ca8ca2f.png">

Signed-off-by: imtsuki <me@qjx.app>

Co-authored-by: imtsuki <me@qjx.app>
2020-01-15 10:24:51 +00:00
memoryruins
896a162f55 Improve readability 2020-01-14 22:52:49 -05:00
memoryruins
edb820c329 Display vscode message after changing cargo-watch options 2020-01-14 20:52:48 -05:00
imtsuki
c390e92fdd Add inlay parameter name hints for function calls
Signed-off-by: imtsuki <me@qjx.app>
2020-01-15 01:18:52 +08:00
bors[bot]
1953ac17fd
Merge #2714
2714: Sanity check for missing server binary r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-01-06 11:39:41 +00:00
Aleksey Kladov
8327049fae Allow disabling inlay hints 2020-01-01 17:04:37 +01:00
Aleksey Kladov
ef24721640 Fixes to progress display 2019-12-31 21:13:30 +01:00
Aleksey Kladov
695b8ba0f0 Sanity check for missing server binary 2019-12-31 20:54:31 +01:00
Aleksey Kladov
ff0ceb30a9 Add semicolons 2019-12-31 18:55:34 +01:00
Aleksey Kladov
cb41ffbbbd Fix NPEs 2019-12-31 18:50:32 +01:00
Aleksey Kladov
6368b40dd9 Work around synchrnonisation issue 2019-12-31 18:38:22 +01:00
Aleksey Kladov
087af54069 Refactor server lifecycle 2019-12-31 18:32:17 +01:00
Aleksey Kladov
0849f7001c Refactor config 2019-12-31 17:34:52 +01:00
Aleksey Kladov
76f283108b Drop needless pubs 2019-12-31 17:28:27 +01:00
Aleksey Kladov
433000be34 Move config to Ctx 2019-12-31 17:28:01 +01:00
Aleksey Kladov
e4b588868f Refactor status activation 2019-12-31 17:22:43 +01:00
Aleksey Kladov
0eb254854d Fix color name 2019-12-31 15:42:05 +01:00
Aleksey Kladov
8662a7dfe5 Drop obsolete color configurations 2019-12-31 14:37:23 +01:00
Aleksey Kladov
26bd7a896b Drop support for legacy colorization 2019-12-31 14:11:25 +01:00
Aleksey Kladov
6c1d92d6c5 Rename file 2019-12-31 14:06:40 +01:00
Aleksey Kladov
519bd0deb5 Fix #2700 2019-12-31 11:44:52 +01:00
Aleksey Kladov
f984ef2652 Switch impure functional style to pure imperative 2019-12-31 03:33:00 +01:00
Aleksey Kladov
cfb0865929 Reduce scope 2019-12-31 02:30:43 +01:00
Aleksey Kladov
96de8076ff Use optional value shortcut 2019-12-31 02:27:26 +01:00
Aleksey Kladov
6561634c68 Remove trivial helpers 2019-12-31 02:21:57 +01:00
Aleksey Kladov
8346bdc04d Rearrange code 2019-12-31 02:17:50 +01:00
Aleksey Kladov
68b7d84974 Restore internal applySourceChange command 2019-12-30 23:46:13 +01:00
Aleksey Kladov
c65e90f7b8 Use Ctx in highlighter 2019-12-30 23:46:13 +01:00
Aleksey Kladov
04f0f5077a Reformat with tsfmt 2019-12-30 23:30:35 +01:00
Aleksey Kladov
233f1dd2a8 Privatize highlighting 2019-12-30 23:17:56 +01:00
Aleksey Kladov
cdd7118cbf Don't request inline hints repeatedly 2019-12-30 22:53:21 +01:00
Aleksey Kladov
23bac12062 Retry inlay hints on content modified error 2019-12-30 22:20:04 +01:00
Aleksey Kladov
08c5d157f9 Thoughtlessly copy-paste a fix to a problem I don't understand 2019-12-30 21:39:34 +01:00
Aleksey Kladov
ac8a142ddd Refactor inlay hints 2019-12-30 21:32:04 +01:00
Aleksey Kladov
efbbc903e6 Add config to Ctx 2019-12-30 21:32:04 +01:00
Aleksey Kladov
7646dc046e Encapsulate highlighting activation 2019-12-30 21:32:04 +01:00
Aleksey Kladov
9ead314005 Encapsulate inlay hints activation 2019-12-30 20:24:30 +01:00
Aleksey Kladov
b8368f09b4 Dead code 2019-12-30 20:16:57 +01:00
Aleksey Kladov
6cc55e4c5c status is not a command 2019-12-30 20:16:07 +01:00
Aleksey Kladov
7b199f6a4b Hints are not commands 2019-12-30 20:10:40 +01:00
Aleksey Kladov
3d008a78d0 Move all commands to ctx 2019-12-30 20:07:04 +01:00
Aleksey Kladov
da80b6c1e1 Minor refactor 2019-12-30 20:00:46 +01:00
Aleksey Kladov
6b118c9b8d Refactor runables 2019-12-30 19:58:44 +01:00
Aleksey Kladov
94be27fc44 Move expand macro to the new context 2019-12-30 19:31:07 +01:00
Aleksey Kladov
68f47a5b10 Cleanup 2019-12-30 19:12:49 +01:00
Aleksey Kladov
260df66b77 Cleanup imports 2019-12-30 19:07:59 +01:00
Aleksey Kladov
ca5c59507f Refactor show syntax tree action 2019-12-30 19:07:59 +01:00
Aleksey Kladov
ac3d0e8340 Run prettier on all files 2019-12-30 19:07:59 +01:00
Aleksey Kladov
9bfeac708d Move parentModule to the new Ctx 2019-12-30 19:07:59 +01:00
Aleksey Kladov
5aebf1081d Refactor applySourceChange 2019-12-30 19:07:59 +01:00
Aleksey Kladov
83d2527880 Move joinLines to the new Ctx 2019-12-30 19:07:59 +01:00
Emil Lauridsen
2d3ebc3406 Fix server config mispell in vscode extension 2019-12-30 18:22:06 +01:00
Aleksey Kladov
5dd9edaeaf Move matching brace to new Ctx 2019-12-30 15:23:55 +01:00
Aleksey Kladov
57df9bed70 Run prettier 2019-12-30 15:11:30 +01:00
Aleksey Kladov
29e86c0c72 More second command to Ctx 2019-12-30 14:53:43 +01:00
Aleksey Kladov
e53ccb6e99 Start new ctx module 2019-12-30 14:42:59 +01:00
Aleksey Kladov
2008f9e0b9 Simplify 2019-12-30 12:29:33 +01:00
Aleksey Kladov
dc559dbe1c Rename extension.ts -> main.ts 2019-12-30 12:29:33 +01:00
Aleksey Kladov
e0fa096bbb Add rollup 2019-12-30 11:20:45 +01:00
Aleksey Kladov
5846221a39 Minimize TypeScript build 2019-12-30 02:22:52 +01:00
bors[bot]
232785251b
Merge #2061
2061: Theme loading and "editor.tokenColorCustomizations" support. r=matklad a=seivan

Fixes: [Issue#1294](https://github.com/rust-analyzer/rust-analyzer/issues/1294#issuecomment-497450325)

TODO: 
- [x] Load themes
- [x] Load existing `ralsp`-prefixed overrides from `"workbench.colorCustomizations"`.
- [x] Load overrides from `"editor.tokenColorCustomizations.textMateRules"`.
- [x] Use RA tags to load `vscode.DecorationRenderOptions` (colors) from theme & overrides.
- [x] Map RA tags to common TextMate scopes before loading colors.
- [x] Add default scope mappings in extension.
- [x] Cache mappings between settings updates. 
- [x] Add scope mapping configuration manifest in `package.json`
- [x] Load configurable scope mappings from settings.
- [x] Load JSON Scheme for text mate scope rules in settings.
- [x] Update [Readme](https://github.com/seivan/rust-analyzer/blob/feature/themes/docs/user/README.md#settings).

Borrowed the theme loading (`scopes.ts`) from `Tree Sitter` with some modifications to reading `"editor.tokenColorCustomizations"` for merging with loaded themes and had to remove the async portions to be able to load it from settings updates. 

~Just a PoC and an idea I toyed around with a lot of room for improvement.~
For starters, certain keywords aren't part of the standard TextMate grammar, so it still reads colors from the `ralsp` prefixed values in `"workbench.colorCustomizations"`. 

But I think there's more value making the extension work with existing themes by maping some of the decoration tags to existing key or keys. 

<img width="453" alt="Screenshot 2019-11-09 at 17 43 18" src="https://user-images.githubusercontent.com/55424/68531968-71b4e380-0318-11ea-924e-cdbb8d5eae06.png">
<img width="780" alt="Screenshot 2019-11-09 at 17 41 45" src="https://user-images.githubusercontent.com/55424/68531950-4b8f4380-0318-11ea-8f85-24a84efaf23b.png">
<img width="468" alt="Screenshot 2019-11-09 at 17 40 29" src="https://user-images.githubusercontent.com/55424/68531952-51852480-0318-11ea-800a-6ae9215f5368.png">


These will merge with the default ones coming with the extension, so you don't have to implement all of them and works well with overrides defined in settings. 

```jsonc
    "editor.tokenColorCustomizations": {
        "textMateRules": [
            {
                "scope": "keyword",
                "settings": {
                    "fontStyle": "bold",
                }
            },
        ]
    },
```


Edit: The idea is to work with 90% of the themes out there by working within existing scopes available that are generally styled. It's not to say I want to erase the custom Rust scopes - those should still remain and eventually worked into a custom grammar bundle for Rust specific themes that target those, I just want to make it work with generic themes offered on the market place for now. 

A custom grammar bundle and themes for Rust specific scopes is out of... scope for this PR. 
We'll make another round to tackle those issues. 


Current fallbacks implemented

```typescript
    [
        'comment',
        [
            'comment',
            'comment.block',
            'comment.line',
            'comment.block.documentation'
        ]
    ],
    ['string', ['string']],
    ['keyword', ['keyword']],
    ['keyword.control', ['keyword.control', 'keyword', 'keyword.other']],
    [
        'keyword.unsafe',
        ['storage.modifier', 'keyword.other', 'keyword.control', 'keyword']
    ],
    ['function', ['entity.name.function']],
    ['parameter', ['variable.parameter']],
    ['constant', ['constant', 'variable']],
    ['type', ['entity.name.type']],
    ['builtin', ['variable.language', 'support.type', 'support.type']],
    ['text', ['string', 'string.quoted', 'string.regexp']],
    ['attribute', ['keyword']],
    ['literal', ['string', 'string.quoted', 'string.regexp']],
    ['macro', ['support.other']],
    ['variable', ['variable']],
    ['variable.mut', ['variable', 'storage.modifier']],
    [
        'field',
        [
            'variable.object.property',
            'meta.field.declaration',
            'meta.definition.property',
            'variable.other'
        ]
    ],
    ['module', ['entity.name.section', 'entity.other']]
```


Co-authored-by: Seivan Heidari <seivan.heidari@icloud.com>
2019-12-29 16:49:40 +00:00
Emil Lauridsen
0cdbd08149 Keep VSCode config mostly backwards compatible 2019-12-25 20:26:06 +01:00
Emil Lauridsen
b9c10ed97f Re-format VSCode extension changes 2019-12-25 19:10:30 +01:00
Emil Lauridsen
178c23f505 Re-implement status display using LSP 3.15 progress event 2019-12-25 19:08:44 +01:00
Emil Lauridsen
500fe46e6c Remove cargo watch supporting code and tests from vscode extension 2019-12-25 17:37:40 +01:00
Emil Lauridsen
6af4bf7a8d Configuration plumbing for cargo watcher 2019-12-25 17:37:40 +01:00
Emil Lauridsen
41a1ec723c Remove cargo-watch from vscode extension.
Still keeps tests around for reference when porting them to rust
2019-12-25 17:37:40 +01:00
Seivan Heidari
25537d294c Fix https://github.com/rust-analyzer/rust-analyzer/pull/2061#discussion_r348716036
Fix 68a5ff050f (r361019340)
2019-12-24 00:04:36 +01:00
Seivan Heidari
b21d9337d9 Merge branch 'master' into feature/themes 2019-12-23 15:35:31 +01:00
kjeremy
6049f60a05 Protect against null as revealed by npm test 2019-12-20 13:52:34 -05:00
Edwin Cheng
bb9c60d908 Use substr instead of endswith 2019-12-18 10:50:54 +08:00
Edwin Cheng
63c59308e6 Add tests 2019-12-18 10:47:45 +08:00
Edwin Cheng
d2c1f8ee26 Add macro span handling 2019-12-18 10:47:45 +08:00
bors[bot]
f51a3fed9f
Merge #2580
2580: Fix highlighting token names r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-12-17 13:46:12 +00:00
Aleksey Kladov
1c8467e20a Fix highlighting token names 2019-12-17 14:45:46 +01:00
bors[bot]
a26840d603
Merge #2568
2568: Add option to disable all-targets. r=matklad a=pftbest

Can be useful in embedded.

Co-authored-by: Vadzim Dambrouski <vadzim.dambrouski@promwad.com>
2019-12-17 13:28:37 +00:00
Aleksey Kladov
2432f278cb Default to client watching on VS Code 2019-12-17 12:41:44 +01:00
Vadzim Dambrouski
22ae4cb906 Fix formatting 2019-12-16 09:01:38 +05:30
Vadzim Dambrouski
a85cd6455a Add option to disable all-targets.
Can be useful in embedded.
2019-12-15 23:32:13 +05:30
Omer Ben-Amram
75353753cd npm run fix 2019-12-15 17:10:39 +02:00
Omer Ben-Amram
498a7912e9 fixed comment 2019-12-15 16:55:39 +02:00
Omer Ben-Amram
324cbe839f Lowercase drive letters on windows before sending to extension. 2019-12-15 16:51:57 +02:00
Omer Ben-Amram
1d9b585c62 make drive comparison case-insensitive. 2019-12-15 15:07:33 +02:00
Omer Ben-Amram
5e4e713fc9 Merge branch 'refs/heads/master' into feature/granular-scopes 2019-12-14 17:29:30 +02:00
Omer Ben-Amram
083010f633 removed type.alias 2019-12-14 13:29:42 +02:00
Omer Ben-Amram
67641d3f5f added decorations 2019-12-14 13:24:07 +02:00
oxalica
f56a2a0790
Enable allFeatures by default and fix lints 2019-12-14 00:48:47 +08:00
oxalica
af4eb26645
Support setting cargo features 2019-12-13 18:16:34 +08:00
Tetsuharu OHZEKI
0e9cabab3f Enable noImplicitReturns option for vscode extension 2019-12-12 01:11:53 +09:00
Tetsuharu OHZEKI
b21bb44c8d Enable noUnusedParameters option for vscode extension 2019-12-12 00:56:29 +09:00
Laurențiu Nicola
273299693b Code: enable prettier trailing commas 2019-12-09 21:07:19 +02:00
Aleksey Kladov
7ac4ea7fec Allow disabling sysroot
Might be helpful for debugging
2019-12-09 19:46:35 +01:00
bors[bot]
e3a9e806ba
Merge #2508
2508: Code: don't check for ra_lsp_server on Windows r=matklad a=lnicola

Workaround for https://github.com/rust-analyzer/rust-analyzer/pull/2503#issuecomment-562980020.

~~(not yet tested on Windows)~~

We can't run `ra_lsp_server --version` right now because the server doesn't seem to handle arguments (so it hangs).

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2019-12-08 19:32:24 +00:00
Laurențiu Nicola
ee2bc73d2a Code: don't check for ra_lsp_server on Windows 2019-12-08 21:14:18 +02:00
Laurențiu Nicola
c7dc067104 Code: bump deps 2019-12-08 20:39:22 +02:00
Laurențiu Nicola
78e8934976 Code: check whether the LSP binary is in PATH 2019-12-08 15:04:37 +02:00
Seivan Heidari
18a0937585 Merge branch 'master' of https://github.com/rust-analyzer/rust-analyzer into feature/themes 2019-11-28 08:19:14 +01:00
Aleksey Kladov
757e593b25 rename ra_ide_api -> ra_ide 2019-11-27 21:35:06 +03:00
Seivan Heidari
358a1bcd70 Merge branch 'master' of https://github.com/rust-analyzer/rust-analyzer into feature/themes 2019-11-21 01:11:41 +01:00
Aleksey Kladov
eec68e6f45
Merge pull request #2297 from kiljacken/master
Add fancy truncation of type hints.
2019-11-20 08:38:25 +03:00
Seivan Heidari
1e2d090ab8 Merge branch 'master' of https://github.com/rust-analyzer/rust-analyzer into feature/themes 2019-11-20 03:56:43 +01:00
Edwin Cheng
1d56b80250 Minor fix for outpu text formating 2019-11-20 01:22:28 +08:00
Edwin Cheng
d16cc223e1 Use DocumentProvider instead of Hover 2019-11-20 01:06:10 +08:00
Emil Lauridsen
dadad36bb9 Move type inlay hint truncation to language server
This commit implements a general truncation framework for HirFormatter
that keeps track of how much has been output so far. This information
can then be used to perform truncation inside the language server,
instead of relying on the client.

Initial support is implemented for truncating types hints using the
maxInlayHintLength server config option. The existing solution in the
VSCode extension has been removed in favor of letting the server
truncate type hints.
2019-11-19 17:23:50 +01:00
Edwin Cheng
4012da07fd Change return type of expand_macro 2019-11-19 22:56:48 +08:00
Edwin Cheng
8010b42b21 Fix npm formatting 2019-11-19 21:49:06 +08:00
Edwin Cheng
3ccd05fedc Add recursive expand in vscode 2019-11-19 21:49:06 +08:00
Seivan Heidari
e5bbb47680 Readding jsonc parser because of https://github.com/rust-analyzer/rust-analyzer/pull/2061\#discussion_r344783715 2019-11-18 02:37:18 +01:00
Seivan Heidari
166636ba77 Merge branch 'master' of https://github.com/rust-analyzer/rust-analyzer into feature/themes 2019-11-18 02:27:53 +01:00
oxalica
b4fae56a25
Fix format 2019-11-16 18:52:47 +08:00
oxalica
4c175fbe8a
Check exit code of cargo watch 2019-11-16 03:44:38 +08:00
oxalica
503920532d
Handle errors when cargo watch fails 2019-11-16 02:49:44 +08:00