Commit graph

739 commits

Author SHA1 Message Date
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
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