Commit graph

933 commits

Author SHA1 Message Date
vsrs
d264d7b9f2 Debug lens fix for a binary. 2020-05-20 09:42:00 +03:00
Aleksey Kladov
39ec581bf6 Fix client-side snippets 2020-05-20 00:49:44 +02:00
Aleksey Kladov
3dd68c1ba3 Implement client-side of SnippetTextEdit 2020-05-19 20:28:27 +02:00
Aleksey Kladov
a752853350 Add snippetTextEdit protocol extension 2020-05-19 20:28:27 +02:00
George Fraser
47ce5ea581 Color attribute functions 2020-05-18 22:55:46 -07:00
bors[bot]
c6ed089671
Merge #4499
4499: CodeLens configuration options r=vsrs a=vsrs

This PR
- adds an option to granularly enable\disable all CodeLens, just like the TypeScript extension.
- fixes a minor bug for doctests. It makes no sense to show `Debug` lens for them as cargo `Can't skip running doc tests with --no-run`.

Co-authored-by: vsrs <vit@conrlab.com>
2020-05-18 07:37:04 +00:00
vsrs
78817a3194 Add "rust-analyzer.lens.enable" 2020-05-18 10:27:00 +03:00
Aleksey Kladov
19a8c1450c Relax VS Code version requirement 2020-05-18 00:16:35 +02:00
vsrs
3d445256fe code formatting 2020-05-17 20:38:50 +03:00
vsrs
dec2f3fa65 Runnable QuickPick with debuggees only 2020-05-17 20:29:59 +03:00
vsrs
dc217bdf90 CodeLens configuration options. 2020-05-17 19:51:44 +03:00
George Fraser
fd83d0e9ba Color macros (fixes #4462) 2020-05-15 19:27:18 -07:00
bors[bot]
d51c1f6217
Merge #4448
4448: Generate configuration for launch.json r=vsrs a=vsrs

This PR adds two new commands: `"rust-analyzer.debug"` and `"rust-analyzer.newDebugConfig"`. The former is a supplement to the existing `"rust-analyzer.run"` command and works the same way: asks for a runnable and starts new debug session. The latter allows adding a new configuration to **launch.json** (or to update an existing one).

If the new option `"rust-analyzer.debug.useLaunchJson"` is set to true then `"rust-analyzer.debug"` and Debug Lens will first look for existing debug configuration in **launch.json**. That is, it has become possible to specify startup arguments, env variables, etc.

`"rust-analyzer.debug.useLaunchJson"` is false by default, but it might be worth making true the default value. Personally I prefer true, but I'm not sure if it is good for all value.

----
I think that this PR also solves https://github.com/rust-analyzer/rust-analyzer/issues/3441.
Both methods to update launch.json mentioned in the issue do not work:
1. Menu. It is only possible to add a launch.json configuration template via a debug adapter. And anyway it's only a template and it is impossible to specify arguments from an extension.

2. DebugConfigurationProvider. The exact opposite situation: it is possible to specify all debug session settings, but it is impossible to export these settings to launch.json.

Separate `"rust-analyzer.newDebugConfig"` command looks better for me.

----
Fixes #4450
Fixes #3441

Co-authored-by: vsrs <vit@conrlab.com>
Co-authored-by: vsrs <62505555+vsrs@users.noreply.github.com>
2020-05-15 14:29:01 +00:00
vsrs
a4ecaa7096 Fix occasional test run during debug configuration 2020-05-15 15:31:09 +03:00
vsrs
abef76bc87 Fix runnable naming in the client side fallback. 2020-05-14 17:33:49 +03:00
vsrs
20fdd14c62 Multiple binaries support for launch.json.
Generate unique names on the LSP side.
2020-05-14 16:02:01 +03:00
vsrs
5f6cdae18f Mixed "bin" and "test" artifacts workaround. 2020-05-14 14:42:40 +03:00
vsrs
af7c50f8a2 Multiple binaries support for launch.json. 2020-05-14 13:48:02 +03:00
vsrs
a233346a2d Fix "rust-analyzer.debug" for QuickPick binaries. 2020-05-14 13:30:05 +03:00
vsrs
be9b0609d5 Runnable quick pick with buttons 2020-05-14 13:22:52 +03:00
Pavan Kumar Sunkara
9f0a7eb97b Make some stuff public so that they can be reused by other tools 2020-05-14 11:14:46 +02:00
vsrs
3ffc26eaeb Remove "rust-analyzer.debug.useLaunchJson" option 2020-05-14 11:12:10 +03:00
bors[bot]
c07050e275
Merge #4400
4400: Enhanced coloring r=georgewfraser a=georgewfraser

This PR builds on #4397 to enhance the existing syntax coloring. 

## Underline mutable variables

The textmate scope `markup.underline` underlines identifiers, which is a nice way to make mutable vars stand out:

<img width="327" alt="Screen Shot 2020-05-09 at 1 18 55 PM" src="https://user-images.githubusercontent.com/1369240/81484179-8bb47d80-91f8-11ea-997d-1dcffbe44aa7.png">

## Italicize static variables

The textmate scope `markup.italic` italicizes identifiers. Italic = static is a common convention in IDEs like IntelliJ:

<img width="288" alt="Screen Shot 2020-05-09 at 1 19 14 PM" src="https://user-images.githubusercontent.com/1369240/81484236-cd452880-91f8-11ea-8478-505ee49bc8b3.png">


Co-authored-by: George Fraser <george@fivetran.com>
2020-05-13 15:43:32 +00:00
vsrs
9ebb2acdca Use launch.json in Debug Lens sessions.
Add the possibility to use existing configurations via Debug Lens
2020-05-13 15:51:15 +03:00
bors[bot]
d6663b7614
Merge #4440
4440: Update packages r=kjeremy a=kjeremy



Co-authored-by: kjeremy <kjeremy@gmail.com>
2020-05-13 12:40:59 +00:00
kjeremy
7ac88f2cb3 Bump packages 2020-05-13 08:36:23 -04:00
bors[bot]
9594fe33fa
Merge #4083
4083: Smol documentation for ast nodes r=matklad a=Veetaha

There is a tremendous amount of TODOs to clarify the topics I am not certain about.
Please @matklad, @edwin0cheng review carefully, I even left some mentions of your names in todos to put your attention where you most probably can give comments.

In order to simplify the review, I separated the codegen (i.e. changes in `ast/generated/nodes.rs`) from `ast_src` changes (they in fact just duplicate one another) into two commits.

Also, I had to hack a little bit to let the docs be generated as doc comments and not as doc attributes because it's easier to read them this way and IIRC we don't support hints for `#[doc = ""]` attributes for now...

Closes #3682 

Co-authored-by: veetaha <veetaha2@gmail.com>
2020-05-13 09:09:46 +00:00
kjeremy
6826f0083e vscode engine 1.45
latest stable
2020-05-12 17:36:03 -04:00
George Fraser
6222f2b709 Leave statics alone 2020-05-12 09:49:48 -07:00
George Fraser
07721d2ab6 Mark up statics and mutables 2020-05-12 09:49:48 -07:00
George Fraser
57c52bd397 Use .rust suffix on scopes 2020-05-12 08:31:43 -07:00
vsrs
e914d622ec DebugConfiguration simplification.
${workspaceRoot} substitution in generated DebugConfiguration.
2020-05-11 18:49:45 +03:00
vsrs
fee0a9fa5a "rust-analyzer.newDebugConfig" command 2020-05-11 18:04:49 +03:00
vsrs
155f060142 "rust-analyzer.debug" command 2020-05-11 16:06:57 +03:00
George Fraser
97428b6d52 Put sigil back to keyword.operator 2020-05-10 15:36:47 -07:00
George Fraser
2d2b32abe5 Change lifetimes back to keyword-ish, tweak builtins for consistency between TextMate and semantic 2020-05-10 13:32:42 -07:00
George Fraser
46566d7a79 Color as as a keyword 2020-05-10 13:07:28 -07:00
George Fraser
e86379ad15 No longer true 2020-05-10 13:07:28 -07:00
George Fraser
60e8e56dfa Color core types as types, not keywords 2020-05-10 13:07:28 -07:00
George Fraser
0881c889bf Color sigil like keyword 2020-05-10 13:07:28 -07:00
George Fraser
d5d154ba3f Color lifetimes like types 2020-05-10 13:07:28 -07:00
George Fraser
a91d15c80c Import built-in textmate grammar, with no changes 2020-05-10 13:07:28 -07:00
George Fraser
da0c8d96d4 Tweak the textmate fallback scopes to be consistent with builtin TextMate grammar and other languages 2020-05-10 13:04:55 -07:00
veetaha
9a82ee0de2 Fix "show syntax tree" command
@matlkad please don't forget to keep it up-to-date!
2020-05-10 20:43:48 +03:00
Edwin Cheng
31d5c8d487 Word fix 2020-05-10 21:05:09 +08:00
vsrs
0ef17ef1ee Merge remote-tracking branch 'upstream/master' into uniformed_debug_lens
# Conflicts:
#	editors/code/src/commands/runnables.ts
2020-05-08 19:34:34 +03:00
vsrs
1be6320ea6
"rust-analyzer.debug.openDebugPane"
Co-authored-by: bjorn3 <bjorn3@users.noreply.github.com>
2020-05-08 19:22:26 +03:00
bors[bot]
8295a9340c
Merge #4329
4329: Look for `cargo`, `rustc`, and `rustup` in standard installation path r=matklad a=cdisselkoen

Discussed in #3118.  This is approximately a 90% fix for the issue described there.

This PR creates a new crate `ra_env` with a function `get_path_for_executable()`; see docs there.  `get_path_for_executable()` improves and generalizes the function `cargo_binary()` which was previously duplicated in the `ra_project_model` and `ra_flycheck` crates.  (Both of those crates now depend on the new `ra_env` crate.)  The new function checks (e.g.) `$CARGO` and `$PATH`, but also falls back on `~/.cargo/bin` manually before erroring out.  This should allow most users to not have to worry about setting the `$CARGO` or `$PATH` variables for VSCode, which can be difficult e.g. on macOS as discussed in #3118.

I've attempted to replace all calls to `cargo`, `rustc`, and `rustup` in rust-analyzer with appropriate invocations of `get_path_for_executable()`; I don't think I've missed any in Rust code, but there is at least one invocation in TypeScript code which I haven't fixed.  (I'm not sure whether it's affected by the same problem or not.) a4778ddb7a/editors/code/src/cargo.ts (L79)

I'm sure this PR could be improved a bunch, so I'm happy to take feedback/suggestions on how to solve this problem better, or just bikeshedding variable/function/crate names etc.

cc @Veetaha 

Fixes #3118.

Co-authored-by: Craig Disselkoen <craigdissel@gmail.com>
Co-authored-by: veetaha <veetaha2@gmail.com>
2020-05-08 10:11:19 +00:00
Aleksey Kladov
3bf5ef02c0 Add master config for inlayHints to make disabling easy 2020-05-08 09:28:15 +02:00
Aleksey Kladov
2904311664 Use the correct color for structs
This works around https://github.com/microsoft/vscode/issues/97162
2020-05-07 18:46:58 +02:00
vsrs
23f4859166 Add CodeLLDB Rust visualization 2020-05-07 18:53:14 +03:00
vsrs
435a17ecd8 Add separate settings for each debug engine. 2020-05-07 18:35:48 +03:00
vsrs
5426e2927e Add additional debug options 2020-05-07 17:07:58 +03:00
Aleksey Kladov
71369f5c59 Better mapping to TextMate scopes for keywords
https://github.com/microsoft/vscode/issues/94367#issuecomment-608629883
2020-05-06 19:03:17 +02:00
Sean Bright
9a4553b833
package.json: Minor configuration spelling fix 2020-05-06 11:22:24 -04:00
vsrs
c4ca6e29c2 Uniformed way to get Debug Lens target executable. 2020-05-06 16:06:21 +03:00
veetaha
c9b395be2b Fix cargo not found on macos bug at vscode extension side 2020-05-05 16:12:56 -07:00
veetaha
a78dd06951 Preliminary refactoring of cargo.ts 2020-05-05 16:12:56 -07:00
veetaha
5eac2d4c55 Drop dead code and a dependency! 2020-05-06 00:39:29 +03:00
guigui64
c22660179c
add the allFeatures flag (true by default) 2020-05-05 22:46:42 +02:00
bors[bot]
8803e748a6
Merge #4166
4166: Defining a default target to support cross-compilation targets  r=matklad a=FuriouZz

Related to #4163 

Co-authored-by: Christophe MASSOLIN <christophe.massolin@gmail.com>
2020-05-05 17:25:52 +00:00
Christophe MASSOLIN
0ab4340cdb Rename defaultTarget to target 2020-05-05 18:01:54 +02:00
szunami
7330b8da63
Fix typo in markdownDescription 2020-05-04 10:27:59 -04:00
Aleksey Kladov
dc19d64f0a Specify cotributed semanticTokenTypes in package.json 2020-05-04 13:10:59 +02:00
Andrew Chin
65234e8828 Remove workspaceLoaded setting
The `workspaceLoaded` notification setting was originally designed to
control the display of a popup message that said:

  "workspace loaded, {} rust packages"

This popup was removed and replaced by a much sleeker message in the
VSCode status bar that provides a real-time status while loading:

  rust-analyzer: {}/{} packages

This was done as part of #3587

The new status-bar indicator is unobtrusive and shouldn't need to be
disabled.  So this setting is removed.
2020-05-01 21:04:41 -04:00
bors[bot]
972afffded
Merge #4222
4222: Introduce C/C++ for Visual Studio Code extension as an alternative debug engine for Debug Code lens. r=matklad a=vsrs

At the moment Debug Code Lens can use only one debug engine: lldb via [CodeLLDB](https://marketplace.visualstudio.com/items?itemName=vadimcn.vscode-lldb) extension.

This PR adds support of the debug engine from the [MS C++ tools](https://marketplace.visualstudio.com/items?itemName=ms-vscode.cpptools) extension, as well as the configuration option. If both extensions are installed, `CodeLLDB` will be used by default.

Another new option `rust-analyzer.debug.sourceFileMap` allows, for example, to step into Rust std library during debugging. Works only with `MS C++ tools`.

On Windows: 
```json
"rust-analyzer.debug.sourceFileMap": {
    "/rustc/4fb7144ed159f94491249e86d5bbd033b5d60550": "${env:USERPROFILE}/.rustup/toolchains/stable-x86_64-pc-windows-msvc/lib/rustlib/src/rust"
}
```
On Linux:
```json
"rust-analyzer.debug.sourceFileMap": {
    "/rustc/4fb7144ed159f94491249e86d5bbd033b5d60550": "~/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust"
}
```

Co-authored-by: vsrs <vit@conrlab.com>
2020-04-30 17:03:26 +00:00
vsrs
06b7175650 fixed lint warning 2020-04-30 18:57:40 +03:00
vsrs
11e9e4b1fb Removed unnecessary extraArgs for cargo invocation 2020-04-30 18:53:34 +03:00
vsrs
10836543d6 Fixed tsfmt and eslint errors. 2020-04-30 18:41:48 +03:00
vsrs
eb6f9c23e1 pass Cargo errors to the Debug output channel 2020-04-30 15:25:04 +03:00
vsrs
73a1947d19 MS C++ tools on linux 2020-04-29 16:52:53 +03:00
vsrs
9153e96e88 better configuration enum items 2020-04-29 14:13:57 +03:00
vsrs
042917e6e3 Configuration settings and source maps support 2020-04-29 13:10:42 +03:00
Jonas Schievink
61c28c2b22 Build extension too 2020-04-28 22:32:23 +02:00
vsrs
48d6e828f1 ms-vscode.cpptools debugger support, initial version. 2020-04-28 17:30:49 +03:00
Christophe MASSOLIN
ed5af989f4 [config] rename cargo.defaultTarget 2020-04-28 00:15:54 +02:00
Christophe MASSOLIN
b7edffe244 Started rust-analyzer.cargo.defaultTarget implementation 2020-04-27 00:11:04 +02:00
bors[bot]
45832b990c
Merge #4145
4145: Remove dead code r=matklad a=matklad



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-04-25 19:30:04 +00:00
Aleksey Kladov
0ac5ed5a84 Remove dead code 2020-04-25 21:22:40 +02:00
veetaha
5f88df82a6 Remove unnecessary async from vscode language client creation 2020-04-25 20:52:50 +03:00
bors[bot]
51a0058d4c
Merge #3998 #4006
3998: Make add_function generate functions in other modules via qualified path r=matklad a=TimoFreiberg

Additional feature for #3639 

- [x] Add tests for paths with more segments
- [x] Make generating the function in another file work
- [x] Add `pub` or `pub(crate)` to the generated function if it's generated in a different module
- [x] Make the assist jump to the edited file
- [x] Enable file support in the `check_assist` helper

4006: Syntax highlighting for format strings r=matklad a=ltentrup

I have an implementation for syntax highlighting for format string modifiers `{}`.
The first commit refactors the changes in #3826 into a separate struct.
The second commit implements the highlighting: first we check in a macro call whether the macro is a format macro from `std`. In this case, we remember the format string node. If we encounter this node during syntax highlighting, we check for the format modifiers `{}` using regular expressions.

There are a few places which I am not quite sure:
- Is the way I extract the macro names correct?
- Is the `HighlightTag::Attribute` suitable for highlighting the `{}`?

Let me know what you think, any feedback is welcome!

Co-authored-by: Timo Freiberg <timo.freiberg@gmail.com>
Co-authored-by: Leander Tentrup <leander.tentrup@gmail.com>
Co-authored-by: Leander Tentrup <ltentrup@users.noreply.github.com>
2020-04-24 20:10:54 +00:00
Aleksey Kladov
919015ce8a Disable onEnter command by default
We are transitioning from experimental to production-ready stance, so
it makes sense to disable potentially disruptive features by default.
2020-04-23 21:01:17 +02:00
Jonathan Dickinson
1d8c25b75c tasks.json Support
Move the task provider anonymous class into a real class, as this seems
to be how Microsoft do this in their documentation.

resolveTask is now implemented, which is used by VSCode to determine how
to execute tasks that the user has defined in tasks.json.
2020-04-22 17:05:04 -07:00
bors[bot]
3f1f3a835a
Merge #4090
4090: Fix config naming r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-04-22 15:26:47 +00:00
Aleksey Kladov
9e16e2b279 Align the name of proc-macro enabling flag
We use `enable`, not `enabled` elsewhere
2020-04-22 17:22:59 +02:00
kjeremy
c6a50aead7 npm update 2020-04-22 10:58:50 -04:00
bors[bot]
e7bb260fbb
Merge #4081
4081: Work around crlf in syntax tree r=matklad a=Veetaha

Workarounds fixes #4067 

Co-authored-by: veetaha <veetaha2@gmail.com>
2020-04-22 11:05:18 +00:00
veetaha
c12d0e0214 Refactor the workaround a bit 2020-04-22 12:35:03 +03:00
veetaha
07bd4bedcb Work around crlf in syntax tree 2020-04-22 12:33:11 +03:00
veetaha
61a931425d Fix .rast tmGrammar to account for numbers in identifiers 2020-04-22 02:00:58 +03:00
Timo Freiberg
74780a15f6 Jump to sourceChanges in other files 2020-04-21 23:04:44 +02:00
Aleksey Kladov
ca61356b01 Add semantic tag for unresolved references
This is a quick way to implement unresolved reference diagnostics.
For example, adding to VS Code config

    "editor.tokenColorCustomizationsExperimental": {
        "unresolvedReference": "#FF0000"
    },

will highlight all unresolved refs in red.
2020-04-18 21:28:51 +02:00
Edwin Cheng
177becea98 Add proc-macro cli command for rust-analyzer 2020-04-16 21:13:57 +08:00
Edwin Cheng
a4b0ce07f8 Add config for proc_macro 2020-04-16 19:28:06 +08:00
bors[bot]
aa887d7ab4
Merge #3948
3948: fix: inlay hints config desyncronization between the frontend and the backend r=matklad a=Veetaha

See the explanation in the issue comment:
https://github.com/rust-analyzer/rust-analyzer/issues/3924#issuecomment-612444566

Workaround-ly fixes: #3924

Co-authored-by: veetaha <veetaha2@gmail.com>
2020-04-16 09:35:42 +00:00
bors[bot]
f1a07dbf55
Merge #3962
3962: Fix parentModule shortcut conflict r=matklad a=CodeSandwich

The default parentModule shortcut conflicts with VSCode's built-in undo selection

Co-authored-by: Igor Żuk <igor.zuk@protonmail.com>
2020-04-15 10:11:20 +00:00
kjeremy
d7efe54515 Bump @types/vscode and vscode-languageclient 2020-04-14 10:20:16 -04:00
Igor Żuk
f8fb009cad
Fix parentModule shortcut conflict
The default parentModule shortcut conflicts with VSCode's built-in undo selection
2020-04-13 12:13:55 +02:00
veetaha
7534266156 fix: inlay hints config desyncronization between the frontend and the backend
See the explanation in the issue comment:
https://github.com/rust-analyzer/rust-analyzer/issues/3924#issuecomment-612444566
2020-04-11 20:01:54 +03:00
bors[bot]
372414d27b
Merge #3942
3942: vscode: fix typing bug in config r=matklad a=Veetaha

I noticed that the type of nullable properties in config is actually non-nullable
![Screenshot from 2020-04-11 15-29-45](https://user-images.githubusercontent.com/36276403/79043702-6a686d80-7c09-11ea-9ae8-f1a777c7d0f2.png)


Co-authored-by: veetaha <veetaha2@gmail.com>
2020-04-11 13:26:17 +00:00
veetaha
12e23bd60b vscode: fix typing bug in config 2020-04-11 15:40:49 +03:00
veetaha
f778242a37 vscode: fix indent 2020-04-11 15:37:06 +03:00
kjeremy
6f0f86d2c5 Enable the SemanticTokensFeature by default
This is covered under vscode's "editor.semanticHighlighting.enabled"
setting plus the user has to have a theme that has opted into highlighting.

Bumps required vscode stable to 1.44
2020-04-08 15:45:39 -04:00
kjeremy
b8426f426a Update some packages 2020-04-07 11:17:54 -04:00
Aleksey Kladov
501c5b45ac Better config scheme & defaults 2020-04-07 08:51:52 +02:00
Aleksey Kladov
ec3fb1cdb4
Merge pull request #3853 from matklad/cf
Make control token modifier less ambiguous
2020-04-06 11:53:56 +02:00
Aleksey Kladov
48bc0ca745 Make control token modifier less ambiguous
In textmate, keyword.control is used for all kinds of things; in fact,
the default scope mapping for keyword is keyword.control!

So let's add a less ambiguous controlFlow modifier

See Microsoft/vscode#94367
2020-04-06 09:57:50 +02:00
bors[bot]
45b9d6d553
Merge #3844
3844: vscode: restore removed default values r=matklad a=Veetaha

After refactoring the config we forgot to set defaults for
some properties like workspaceLoaded, callInfo.full, etc.
This commit restored them to being turned on by defult,
as well added defaults for other props to be more explicit
on their defualt value.
cc @matklad 

Co-authored-by: veetaha <veetaha2@gmail.com>
2020-04-04 13:32:18 +00:00
veetaha
90959b29e0 vscode: log server binary path 2020-04-04 16:10:06 +03:00
veetaha
486cb5b79a vscode: restore removed default values
After refactoring the config we forgot to set defaults for
some properties like workspaceLoaded, callInfo.full, etc.
This commit restored them to being turned on by defult,
as well added defaults for other props to be more explicit
on their defualt value.
2020-04-04 15:57:23 +03:00
Aleksey Kladov
ab29806f32 Include grammar for syntax trees into vsix 2020-04-03 20:00:06 +02:00
Aleksey Kladov
2a968d4554 Set semantic tokens supertypes 2020-04-03 14:09:12 +02:00
kjeremy
db102c4766 Bumps vsce to 1.75
Fixes a security vulnerability
2020-04-02 12:03:30 -04:00
Aleksey Kladov
9ca69994af Fix semantic coloring 2020-04-02 15:52:25 +02:00
Aleksey Kladov
407ab946ab better wording 2020-04-02 14:39:37 +02:00
Aleksey Kladov
8a788c764f Allow fully overriding check and fmt commands 2020-04-02 14:35:51 +02:00
Aleksey Kladov
7a4ebd2c8d Remove vscode_lldb setting 2020-04-02 12:56:14 +02:00
Aleksey Kladov
48c58309cc Lean onto default implementation of configs 2020-04-02 12:47:58 +02:00
Aleksey Kladov
e4cf40a152 New config in package.json 2020-04-02 12:27:09 +02:00
veetaha
036a8aee2a vscode: postrefactor 2020-04-02 11:13:38 +03:00
veetaha
e763b279a8 vscode: postrefactor variable names 2020-04-02 11:13:38 +03:00
veetaha
d453281bb2 vscode: add goto definition from rust file to syntax tree editor 2020-04-02 11:13:16 +03:00
bors[bot]
98f7842e40
Merge #3820
3820: Remove old syntax highlighting r=matklad a=matklad



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-04-02 07:55:11 +00:00
Aleksey Kladov
309fc70155 Remove old syntax highlighting 2020-04-02 09:52:27 +02:00
bors[bot]
f0ba01cd43
Merge #3817
3817: vscode: highlight syntax tree ro editor r=matklad a=Veetaha

Small textmate grammar declaration to make rust-analyzer syntax tree more easily inspectable:
Btw, if we change the file extension of our `ra_syntax/test_data/**` files to `.rast` they should be highlighted in vscode too.

The colors of the tokens are actually going to be color-theme dependent, or you can customize them via:
```jsonc
{
    "editor.tokenColorCustomizations": {
        "textMateRules": [ { "scope": "name", "settings": { /* */ } } ] 
    }
}
```
![image](https://user-images.githubusercontent.com/36276403/78204947-99f9d600-74a3-11ea-8315-cb1c87810c7c.png)

Related: #3682

Co-authored-by: veetaha <veetaha2@gmail.com>
2020-04-02 07:32:14 +00:00
veetaha
62ed01a107 vscode: add highlighting of syntax tree 2020-04-02 05:38:52 +03:00
veetaha
f4f79383b1 vscode: add support for light themes and color customization for syntax tree highlights 2020-04-02 01:20:08 +03:00
kjeremy
e88ee75ffb rollup 2.3.2 2020-04-01 14:44:30 -04:00
bors[bot]
f77fc158fc
Merge #3780 #3787
3780: Simplify r=matklad a=Veetaha

I absolutely love tha fact that removing `.clone()` simplifies the code comparing to other languages where it's actually the contrary (ahem ~~`std::move()`~~)

3787: vscode: add syntax tree inspection hovers and highlights r=matklad a=Veetaha

![inspect-tree](https://user-images.githubusercontent.com/36276403/78029767-c7426900-7369-11ea-9ed6-b8a0f8e05bac.gif)
I implemented the reverse mapping (when you hover in the rust editor), but it seems overcomplicated, so I removed it

Related #3682 

Co-authored-by: veetaha <veetaha2@gmail.com>
Co-authored-by: Veetaha <veetaha2@gmail.com>
2020-03-31 17:40:03 +00:00
veetaha
90cc8cc528 vscode: small refactor 2020-03-31 20:29:07 +03:00
veetaha
f3612b7024 vscode: scroll to the syntax node in rust editor when highlighting 2020-03-31 20:28:10 +03:00
Veetaha
3b09768ebc
vscode: apply review nits 2020-03-31 19:06:07 +03:00
Aleksey Kladov
6343ddd009 Revert accidental package.json changes 2020-03-31 17:00:15 +02:00
bors[bot]
fa3c7742af
Merge #3790
3790: Better names for config structs r=matklad a=matklad



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-03-31 14:06:03 +00:00
veetaha
4fbca1c64d vscode: use ctx.subscriptions instead of local .disposables 2020-03-31 16:57:03 +03:00
Aleksey Kladov
f5b01d6544 WIP: uniformalize external tools config 2020-03-31 15:55:05 +02:00
kjeremy
b3b8d31c5e Update node deps 2020-03-31 09:47:53 -04:00
veetaha
09a760e52e vscode: add syntax tree inspection hovers and highlights 2020-03-31 16:20:59 +03:00
Tim
3eb45b9922 Pass string instread of WorkspaceFolder 2020-03-31 10:24:01 +01:00
Tim
9ef1e9efc6 Remove unnecessary null check 2020-03-31 09:11:22 +01:00
Tim
a781a58fe2 Throw error if no folder is opened 2020-03-31 09:06:52 +01:00
Tim
6e535915bd Use namespace import 2020-03-31 09:06:46 +01:00
Tim
768aa4259f Add basic task support
This adds basic support for running `cargo build`, `cargo run`, etc.
2020-03-30 21:23:21 +01:00
Kirill Bulatov
b892a48740 Code review fixes
Co-Authored-By: Veetaha <veetaha2@gmail.com>
2020-03-30 13:39:14 +03:00
Kirill Bulatov
8a23bec2cd Style fixes 2020-03-30 13:39:14 +03:00
Kirill Bulatov
a9dd442733 Send the config from the client 2020-03-30 13:39:14 +03:00
Kirill Bulatov
019f269a0a Process configuration response draft 2020-03-30 13:39:14 +03:00
Kirill Bulatov
8c4aab0c80 Client side draft 2020-03-30 13:39:14 +03:00
Veetaha
51156cbf03
vscode: fix release tag retrieval
Co-Authored-By: Laurențiu Nicola <lnicola@users.noreply.github.com>
2020-03-27 11:05:37 +02:00
veetaha
0072aa31ed vscode: show release tag with along with the commit hash for RA version command 2020-03-27 00:38:03 +02:00
bors[bot]
d2619bf0ca
Merge #3725
3725: vscode: fix local devel and remove disposables memory leak on server restrart r=matklad a=Veetaha



Co-authored-by: veetaha <veetaha2@gmail.com>
2020-03-26 21:47:26 +00:00
veetaha
261ef1c455 vscode: small post-refactor 2020-03-26 23:45:01 +02:00
veetaha
e1a5e9565b vscode: fix memory leak on server restart
The memory leak was because on the server restrart the array of extensionContext.substiptions was not cleared
2020-03-26 23:44:19 +02:00
veetaha
68ff71e3ab vscode: fix local devel
The value of releaseTag is not undefined, but null in actual package.json
2020-03-26 23:42:40 +02:00
bors[bot]
ece8fa81bb
Merge #3726
3726: vscode: refactor analyzer status r=matklad a=Veetaha



Co-authored-by: veetaha <veetaha2@gmail.com>
2020-03-26 09:49:12 +00:00
veetaha
d1721021ef vscode: refactor analyzer status 2020-03-25 21:00:04 +02:00
Aleksey Kladov
aed535fa7a Use the right arch name for x86 (32 bit) 2020-03-25 10:51:03 +01:00
Matt Hooper
6f239a581a Extension types and rendering 2020-03-24 23:22:41 +01:00
bors[bot]
1d6024e460
Merge #3695
3695: vscode: simplify and refactor config r=matklad a=Veetaha

Removed unnecessary interfaces, changed `cfg` to be a getter to ensure the fresh values any time possible.
Migrated from explicit casts to implicit.

Co-authored-by: veetaha <veetaha2@gmail.com>
2020-03-24 09:03:40 +00:00
bors[bot]
c6db6e2352
Merge #3696 #3698 #3703
3696: vscode: more type safety r=matklad a=Veetaha



3698: Consider references when applying postfix completions r=matklad a=SomeoneToIgnore

Sometimes my RA debugging workflow breaks because `.dbg` is applied to the variable that is used later in the code.
It's safer to consider the refences to avoid this for completions that may trigger the move.

3703: Don't try to enable proposed API's on stable r=matklad a=matklad



bors r+
🤖

Co-authored-by: veetaha <veetaha2@gmail.com>
Co-authored-by: Kirill Bulatov <mail4score@gmail.com>
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-03-24 08:54:30 +00:00
Aleksey Kladov
be4977da7f Don't try to enable proposed API's on stable 2020-03-24 09:34:54 +01:00
veetaha
4cee3e9f22 vscode: more type safety 2020-03-24 01:11:36 +02:00
veetaha
65e2d8a0c8 vscode: simplify and refactor config 2020-03-24 01:00:57 +02:00
Veetaha
95b5129a8a
vscode: remove unnecessary code
This cancel is unnecessary since we cancel the previous inlay hints requests in `fetchHints()` method itself. This is not a hard error, we just called cancel() 2 times.
2020-03-20 21:23:56 +02:00
Aleksey Kladov
8ee7780ca9 ⬆️ npm 2020-03-20 13:07:43 +01:00
Aleksey Kladov
4b5435b52b Make from-source install use cargo installed binary by default 2020-03-20 13:07:12 +01:00
Aleksey Kladov
7adcadd279 Downgrade vscode-langaugeclient
Looks like it broke completion :(
2020-03-19 15:08:10 +01:00
Aleksey Kladov
13af63a403
Merge pull request #3641 from darinmorrison/rollup-typescript
Some improvements to rollup and ts config
2020-03-19 11:26:00 +01:00
Aleksey Kladov
8f8f6b47de ⬆️ npm 2020-03-19 10:30:41 +01:00
Aleksey Kladov
3d1cb5e20f Simplify extension tag sniffing 2020-03-19 09:37:03 +01:00
bors[bot]
aca3c3086e
Merge #3629
3629: Alternative aproach to plugin auto update r=matklad a=matklad

This is very much WIP (as in, I haven't run this once), but I like the result so far.

cc @Veetaha 

The primary focus here on simplification:

* local simplification of data structures and control-flow: using union of strings instead of an enum, using unwrapped GitHub API responses
* global simplification of control flow: all logic is now in `main.ts`, implemented as linear functions without abstractions. This is stateful side-effective code, so arguments from [Carmack](http://number-none.com/blow/john_carmack_on_inlined_code.html) very much apply. We need all user interractions, all mutations, and all network requests to happen in a single file. 
* as a side-effect of condensing everything to functions, we can get rid of various enums. The enums were basically a reified control flow:

```
enum E { A, B }

fn foo() -> E {
    if cond { E::A } else { E::B }
}

fn bar(e: E) {
    match e {
        E::A => do_a(),
        E::B => do_b(),
    }
}

==>>

fn all() {
    if cond { do_a() } else { do_b() }
}
```

* simplification of model: we don't need to reinstall on settings update, we can just ask the user to reload, we don't need to handle nightly=>stable fallback, we can ask the user to reinstall extension, (todo) we don't need to parse out the date from the version, we can use build id for nightly and for stable we can write the info directly into package.json.

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-03-19 08:06:48 +00:00
Aleksey Kladov
fb6e655de8 Rewrite auto-update
Everything now happens in main.ts, in the bootstrap family of
functions. The current flow is:

* check everything only on extension installation.
* if the user is on nightly channel, try to download the nightly
  extension and reload.
* when we install nightly extension, we persist its release id, so
  that we can check if the current release is different.
* if server binary was not downloaded by the current version of the
  extension, redownload it (we persist the version of ext that
  downloaded the server).
2020-03-19 09:04:59 +01:00
Darin Morrison
630888df5b Target es2019 (code 1.43 uses chromium 78) 2020-03-18 16:30:34 -06:00
Darin Morrison
0ec20234a7 Add typing annotations for rollup config 2020-03-18 16:30:34 -06:00
Darin Morrison
482a7c2262 Update deps; regen lock file; fix minimist CVE 2020-03-18 10:36:11 -06:00
Emil Lauridsen
e154132c91 Remove outDirOverrides 2020-03-17 14:55:44 +01:00
Emil Lauridsen
9e7dbb1abd Remove unused config from VSCode ext 2020-03-17 14:47:05 +01:00
Emil Lauridsen
f5a2fcf8f5 Change existing OUT_DIR override config to make use of new infrastructure 2020-03-17 14:47:05 +01:00
Emil Lauridsen
33c6c7abc6 Support loading OUT_DIR from cargo check at launch 2020-03-17 14:47:05 +01:00
Aleksey Kladov
ae662617a2 Separate persistent mutable state from config
That way, we clearly see which things are not change, and we also
clearly see which things are persistent.
2020-03-16 22:02:11 +01:00
Aleksey Kladov
a00bab5781 ⬆️ npm 2020-03-16 14:57:32 +01:00
bors[bot]
200c275c2e
Merge #3534
3534: Feature: vscode impl nightlies download and installation r=Veetaha a=Veetaha

I need to test things more, but the core shape of the code is quite well-formed.
The main problem is that we save the release date only for nightlies and there are no means to get the release date of the stable extension (i.e. for this we would need to consult the github releases via a network request, or we would need to somehow save this info into package.json or any other file accessible from the extension code during the deployment step, but this will be very hard I guess).
So there is an invariant that the users can install nightly only from our extension and they can't do it manually, because when installing the nightly `.vsix` we actually save its release date to `globalState`

Closes: #3402

TODO:
- [x] More manual tests and documentation

cc @matklad @lnicola 

Co-authored-by: Veetaha <gerzoh1@gmail.com>
Co-authored-by: Veetaha <veetaha2@gmail.com>
2020-03-16 10:26:31 +00:00
Veetaha
5a0041c5aa
vscode-postrefactor: migrate to arrow functions 2020-03-16 12:19:26 +02:00
Veetaha
fc47274541
vscode-postrefactor: fix syntax error 2020-03-16 12:18:30 +02:00
Veetaha
d38d59fed8
vscode-postrefactor: prefer arrow functions 2020-03-16 12:17:36 +02:00
bors[bot]
a99cac671c
Merge #3540
3540: Swtches to rust SSR query check r=matklad a=mikhail-m1

related to #3186 

Co-authored-by: Mikhail Modin <mikhailm1@gmail.com>
2020-03-16 09:48:09 +00:00
Mikhail Modin
b150965ed7 Swtches to rust SSR query check 2020-03-15 21:23:18 +00:00
Veetaha
9789f984cb vscode: sync package-lock.json version with package.json 2020-03-14 03:20:39 +02: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