Commit graph

8152 commits

Author SHA1 Message Date
Aleksey Kladov
1f1bda2c5a Remove unnecessary dep 2020-02-26 14:21:23 +01:00
Edwin Cheng
871dc2bd3c Remove duplicate comment 2020-02-26 20:55:11 +08:00
Edwin Cheng
ffdc740446 Add recursive support in original_range 2020-02-26 20:53:00 +08:00
Aleksey Kladov
80f8e474a0
Merge pull request #3318 from matklad/cleanup
Reduce visibility
2020-02-26 13:28:18 +01:00
Aleksey Kladov
ade0176c20 Remove dead code 2020-02-26 13:26:53 +01:00
Aleksey Kladov
09bc7ca74d Reduce visibility 2020-02-26 13:22:46 +01:00
Aleksey Kladov
5c64ad27e0
Merge pull request #3222 from matklad/identity
Introduce Semantics API
2020-02-26 13:04:22 +01:00
Aleksey Kladov
c3a4c4429d Refactor primary IDE API
This introduces the new type -- Semantics.
Semantics maps SyntaxNodes to various semantic info, such as type,
name resolution or macro expansions.

To do so, Semantics maintains a HashMap which maps every node it saw
to the file from which the node originated. This is enough to get all
the necessary hir bits just from syntax.
2020-02-26 12:55:50 +01:00
Aleksey Kladov
04deae3dba
Merge pull request #3317 from matklad/no-unicase
Actually drop unicase dependency
2020-02-26 12:00:33 +01:00
Aleksey Kladov
21fa338bd6
Merge pull request #3316 from matklad/dedup
Remove code duplication in tests
2020-02-26 11:59:59 +01:00
Aleksey Kladov
8046622871 Actually drop unicase dependency 2020-02-26 11:38:33 +01:00
Aleksey Kladov
52fd19621c Remove code duplication in tests 2020-02-26 11:25:07 +01:00
adamrk
b1ee6d17a4 get matches from code.descendants 2020-02-25 23:53:29 +01:00
adamrk
94603d9848 save comments as ra_syntax::ast::Comment 2020-02-25 23:35:16 +01:00
Veetaha
655c8337c0 vscode: fix vscode-vim keybindings conflict
vscode-vim extension overrides the `type` command so that it prevents
some keypresses to reach the text document editor.
It conflicts with our `onEnter` keybinding
that is used to support automatic doc comments extending and
indentation insertion.

The VSCode-native way to implement this would be
to use regular expressions, but as per matklad it is
considered not acceptable for the language server.

Thus we implement it via a `Enter` keybinding that
invokes our `onEnter` command which sends
a request to rust-analyzer process and applies
the appropriate source change recieved from it.

At the end of the day we may only apply
ad hoc workarounds for conflicting extensions.
But vscode has another bug for that. You
either cannot use parantheses in `when` condition
of a keybinding or it just malfunctions.

See an issue about that here: https://github.com/microsoft/vscode/issues/91473
To get the ultimate context, follow this zulip thread: https://rust-lang.zulipchat.com/#narrow/stream/185405-t-compiler.2Fwg-rls-2.2E0/topic/Enhanced.20typing
2020-02-25 23:20:07 +02:00
bors[bot]
ae0aeb1b23
Merge #3307
3307: Semantic Ranges r=matklad a=kjeremy



Co-authored-by: Jeremy Kolb <kjeremy@gmail.com>
Co-authored-by: kjeremy <kjeremy@gmail.com>
2020-02-25 21:11:33 +00:00
nmio
f1b7349e7a clean up 2020-02-25 20:56:24 +00:00
kjeremy
fa355d6339 Rename back to highlight and check event's again highlight range 2020-02-25 14:44:47 -05:00
nmio
39bd3b2bd7 Merge branch 'master' of https://github.com/rust-analyzer/rust-analyzer into find-cargo-toml-up-the-fs 2020-02-25 18:01:59 +00:00
Jeremy Kolb
8f6f864547 Semantic Ranges 2020-02-25 11:37:43 -05:00
bors[bot]
d3040c0deb
Merge #3305
3305: Simplify r=matklad a=matklad



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-02-25 13:59:44 +00:00
Aleksey Kladov
d7da42bd40 Simplify 2020-02-25 14:59:13 +01:00
bors[bot]
7763f425d9
Merge #3304
3304: ⬆️ rowan r=matklad a=matklad



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-02-25 13:45:15 +00:00
Aleksey Kladov
469011169b ⬆️ rowan 2020-02-25 14:44:51 +01:00
bors[bot]
744ec58bc3
Merge #3303
3303: Simplify r=matklad a=matklad



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-02-25 12:51:36 +00:00
Aleksey Kladov
6542ab89ce Simplify 2020-02-25 13:49:34 +01:00
bors[bot]
3853a3b643
Merge #3298
3298: Bump chalk and replace TypeFamily with Interner r=flodiebold a=lnicola



Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2020-02-25 11:59:47 +00:00
bors[bot]
e9c9f47fe0
Merge #3302
3302: Replace generic with a concrete type r=matklad a=matklad



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-02-25 11:44:00 +00:00
Aleksey Kladov
136151515a Replace generic with a concrete type 2020-02-25 12:43:08 +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
bors[bot]
1fe48a0115
Merge #3159
3159: Server-side Semantic Tokens r=matklad a=kjeremy

Takes the output of `syntax_highlighting` and converts it to the proposed semantic tokens API (so far only `textDocument/semanticTokens`. There's a lot of cool stuff we could do with this and the "Inspect Editor Tokens and Scopes" vscode command (pic below) is a cool way to see what has tokens and what doesn't.

Incredibly hacky and could panic due to unwraps, `panic!` etc. To use: run with `code-insiders --enable-proposed-api matklad.rust-analyzer`. If you try to run this without `--enable-proposed-api` it will crash.

![image](https://user-images.githubusercontent.com/4325700/74595603-7c66cf00-5011-11ea-9593-312663f04fc1.png)


@matklad I'm mostly looking for design feedback.

Co-authored-by: kjeremy <kjeremy@gmail.com>
Co-authored-by: Jeremy Kolb <kjeremy@gmail.com>
2020-02-25 10:02:21 +00:00
bors[bot]
5e6f4ca690
Merge #3299
3299: vscode: migrate to request type api r=matklad a=Veetaha

More type-safety to the god of type-safety.

Co-authored-by: Veetaha <gerzoh1@gmail.com>
2020-02-25 09:55:56 +00:00
Jeremy Kolb
17ffdf9c27 Add docs 2020-02-24 21:17:20 -05:00
kjeremy
9f0cfb7ad2 Teach the server about Semantic Tokens proposed LSP 2020-02-24 20:59:58 -05: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
bors[bot]
558d263a0c
Merge #3296
3296: vscode: bump TypeScript version r=matklad a=Veetaha

There is a new [`type-only` import and export feature](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-8.html#-type-only-imports-and-export), but let's keep our codebase as simple as it is now.
Also, top-level await 🎉, though with a caveat ))

![image](https://user-images.githubusercontent.com/36276403/75185341-93629b00-574e-11ea-8d5c-4a4293f140f7.png)


Co-authored-by: Veetaha <gerzoh1@gmail.com>
2020-02-24 23:09:19 +00: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