Commit graph

1126 commits

Author SHA1 Message Date
gfreezy
c0add813e9 mark as visited on entry instead of left 2018-12-22 22:40:41 +08:00
Aleksey Kladov
5c7e8f47a8 less chatty logging 2018-12-22 15:09:08 +03:00
Aleksey Kladov
90f20f8c53 less verbose debug 2018-12-22 12:38:24 +03:00
Aleksey Kladov
94241cec04 less verbose debug for library data 2018-12-22 11:57:42 +03:00
Aleksey Kladov
2639997973 log times 2018-12-22 11:53:20 +03:00
Aleksey Kladov
49e746b010 completion uses hir scopes 2018-12-22 11:01:03 +03:00
gfreezy
0267df3815 not visit the same crateId only once 2018-12-22 15:30:58 +08:00
bors[bot]
4e4ca27eab Merge #319
319: Completion icons r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2018-12-21 23:28:47 +00:00
Aleksey Kladov
ea763c73b8 fix snippet icon 2018-12-22 02:28:09 +03:00
Aleksey Kladov
498e3a6846 binding icon 2018-12-22 02:24:59 +03:00
Aleksey Kladov
8e056ef042 debug pring 2018-12-22 02:23:25 +03:00
Aleksey Kladov
97cb463c9b moar icons 2018-12-22 02:20:14 +03:00
bors[bot]
e4d0930d9c Merge #316
316: Fix handling of nested self in paths r=matklad a=DJMcNab

See https://github.com/rust-analyzer/rust-analyzer/issues/231#issuecomment-442449505.

Co-authored-by: DJMcNab <36049421+djmcnab@users.noreply.github.com>
2018-12-21 23:19:14 +00:00
Aleksey Kladov
238b52358d more icons 2018-12-22 02:03:18 +03:00
DJMcNab
bb1ee2f13a Move the self handling from directly inside the loop 2018-12-21 23:01:16 +00:00
Aleksey Kladov
f1f2804c71 move completion items to conv 2018-12-22 01:59:32 +03:00
DJMcNab
1dffbe5c37 Remove TODO on self_hosting_parsing
This improving this code is not a good use of people-time, and this
might be the most performant approach nonwithstanding
an api for this use case being added to walkdir
2018-12-21 22:44:31 +00:00
Aleksey Kladov
328d123f5b specify completion item kind 2018-12-22 01:42:26 +03:00
Aleksey Kladov
284e894069 cleanup 2018-12-22 01:42:26 +03:00
Aleksey Kladov
25dda42f37 introduce ComletionItemKind 2018-12-22 01:42:26 +03:00
Aleksey Kladov
ebb584ce66 rename completion kind 2018-12-22 01:42:26 +03:00
DJMcNab
4dbf71d332 Remove uneeded todo in lexer 2018-12-21 22:41:09 +00:00
DJMcNab
d8d60215da Fix handling of nested self in paths 2018-12-21 22:29:59 +00:00
bors[bot]
184665ff9b Merge #315
315: Split completion into manageable components r=matklad a=matklad

The main idea here is to do completion in two phases:

* first, we figure out surrounding context
* then, we run a series of completers on the given context. 

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2018-12-21 22:04:32 +00:00
Aleksey Kladov
2ae87ffc9a cleanup 2018-12-22 01:03:58 +03:00
Aleksey Kladov
a8e04a7028 docs 2018-12-22 01:01:40 +03:00
Aleksey Kladov
200cc0a1e3 rename tests 2018-12-22 00:55:20 +03:00
Aleksey Kladov
ccca5aae43 scope-based copmletions on original file 2018-12-22 00:52:02 +03:00
Aleksey Kladov
2136e75c0b move path completion to a separate component 2018-12-21 23:04:56 +03:00
Aleksey Kladov
2351308d92 remove explicit serde_derive 2018-12-21 22:39:59 +03:00
Aleksey Kladov
67ac0a423f join lines collapses use_trees 2018-12-21 21:06:01 +03:00
Aleksey Kladov
cbe67339df more completion components 2018-12-21 20:55:00 +03:00
Aleksey Kladov
c2bf174e9c Start splitting completion into components 2018-12-21 20:25:29 +03:00
DJMcNab
bd5a358910 Fix where clauses using fully qualified path syntax 2018-12-21 17:20:38 +00:00
DJMcNab
380733d6d0 Undo the previous mistaken change and make publish_decorations optional
See https://github.com/Microsoft/language-server-protocol/issues/567
for motivations to not require `InitializationOptions`

TODO: Check if there are any other protocol extensions
which should be disabled if not implemented on the client
2018-12-21 17:00:31 +00:00
Aleksey Kladov
e086cc8db5 hide empty changes 2018-12-21 19:13:26 +03:00
Aleksey Kladov
12810b93c5 wip 2018-12-21 19:10:07 +03:00
Aleksey Kladov
9de3a45be6 add tests for pd 2018-12-21 18:53:00 +03:00
Aleksey Kladov
a5987bd715 show debug repr of literals 2018-12-21 18:49:52 +03:00
Aleksey Kladov
45232dfa68 organize completion tests better 2018-12-21 18:13:21 +03:00
gfreezy
66d15bb2da add #[cfg(test)] 2018-12-21 22:45:38 +08:00
gfreezy
77eaa208ed rename to dfs_find 2018-12-21 22:30:41 +08:00
gfreezy
792dabc0a6 When constructing a crate graph, detect and forbid cycles.
fixed #300
2018-12-21 22:27:04 +08:00
Aleksey Kladov
d4ef07b235 use completions in API 2018-12-21 15:50:07 +03:00
Aleksey Kladov
ba0072401c use Completions to collect completions 2018-12-21 15:46:01 +03:00
Aleksey Kladov
052e20162a docs 2018-12-21 15:34:11 +03:00
Aleksey Kladov
0ce82516c1 introduce Completions 2018-12-21 15:32:29 +03:00
Aleksey Kladov
4092b8d0b5 make compleion item details private 2018-12-21 15:19:46 +03:00
Aleksey Kladov
b5c5995bf1 use builder interface for completion item 2018-12-21 14:38:41 +03:00
Aleksey Kladov
b0ff6176ed flip params 2018-12-21 14:02:51 +03:00
Aleksey Kladov
74406ca8ea introduce completion_item module 2018-12-21 14:02:14 +03:00
bors[bot]
463e5af3f2 Merge #306
306: Finish weird exprs r=DJMcNab a=DJMcNab

Fix #290.

Note that I'm not certain my use of `p.nth(1) == Ident` is entirely consistent with `libsyntax` - in the original, [`is_union_item`](9622f9dc47/src/libsyntax/parse/parser.rs (L4593-L4596)) uses `t.is_ident() && !t.is_reserved_ident()`, whereas we effectively only do `is_ident`. However, I cannot find the definition of `is_reserved_ident` (even searching the rust repository only gives uses, no definitions), so this will have to do unless someone else can find it :|.

Co-authored-by: DJMcNab <36049421+djmcnab@users.noreply.github.com>
2018-12-21 10:04:00 +00:00
DJMcNab
9beee92500 Add comment about the source of the weird_exprs test 2018-12-21 10:03:02 +00:00
Aleksey Kladov
fd927ea3a9 use root-relative paths 2018-12-21 12:30:28 +03:00
Aleksey Kladov
b5b44659a4 edits use source-root API 2018-12-21 12:18:14 +03:00
Aleksey Kladov
0063f03e86 hide atom edits a bit 2018-12-21 11:52:32 +03:00
Aleksey Kladov
164d53b22f better debug impls 2018-12-21 11:49:18 +03:00
Aleksey Kladov
aa628f4749 fix SourceFileEdit name 2018-12-21 11:15:23 +03:00
Aleksey Kladov
b7d8bf1262 tweak canceled message 2018-12-21 11:08:43 +03:00
bors[bot]
f1fafeee02 Merge #305 #307
305: Fold curly blocks r=matklad a=matklad



307: ⬆️ 1.31.1 r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2018-12-20 19:58:10 +00:00
Aleksey Kladov
2956e81295 ⬆️ 1.31.1 2018-12-20 22:57:38 +03:00
DJMcNab
da6be9fdda Add weird_exprs test 2018-12-20 19:47:29 +00:00
DJMcNab
55ebe449c9 Fix parsing of contextual_keyword union 2018-12-20 19:46:03 +00:00
Aleksey Kladov
23b040962f fold curly blocks 2018-12-20 22:43:06 +03:00
Aleksey Kladov
8d7e8a175e generalize folding tests
By using xml-like tags, we will be able to test nested foldings.
2018-12-20 22:30:30 +03:00
DJMcNab
a349db7178 Run gen-tests 2018-12-20 19:10:37 +00:00
DJMcNab
1d1950336f Use a better way of skipping SEMIs 2018-12-20 19:07:11 +00:00
DJMcNab
dc1c64f5b9 Support a blank expression before a semicolon 2018-12-20 19:07:11 +00:00
DJMcNab
0ffba1e896 Fix broken test is deleted comment 2018-12-20 17:29:26 +00:00
DJMcNab
134fe4f566 Fix the tests and fix the precommit hook 2018-12-20 16:45:54 +00:00
DJMcNab
466885aa5b Fix missing DOTDOTEQs 2018-12-20 16:22:13 +00:00
DJMcNab
f35151afed Don't require a command before EQ in a where clause 2018-12-20 15:50:42 +00:00
DJMcNab
84ff52390d Rename test_fail to test_err 2018-12-20 15:09:57 +00:00
DJMcNab
63ca8bc91a Change parser tests dir to inline/ok and inline/err 2018-12-20 15:09:22 +00:00
DJMcNab
e2a7e94518 Ensure that the parser tests pass or fail correctly 2018-12-20 13:33:00 +00:00
bors[bot]
346456f59f Merge #301
301: Fix break in a condition r=matklad a=DJMcNab

The part of fixing #290.

Co-authored-by: DJMcNab <36049421+djmcnab@users.noreply.github.com>
2018-12-20 12:41:55 +00:00
DJMcNab
27e814e182 Simplify NO_BLOCK testing 2018-12-20 12:28:59 +00:00
DJMcNab
70e5fb98a0 Disable highlighting if disabled
This isn't working properly because we don't dynamically disable or enable it

TODO: work out why highlighting can be enabled mid session.

TODO: Improve settings handling
2018-12-20 12:16:44 +00:00
Aleksey Kladov
c96011833c extend comment 2018-12-20 14:35:37 +03:00
DJMcNab
5205c016e9 Fix ambiguity with if break
Brought up by #290
2018-12-20 11:35:02 +00:00
Aleksey Kladov
bb2bafb606 docs for input queries 2018-12-20 14:12:47 +03:00
bors[bot]
d8c6b8d999 Merge #297
297: Use ContentModified error code r=matklad a=matklad

25679c2e4b

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2018-12-20 09:23:27 +00:00
Aleksey Kladov
b2f2621c17 Use ContentModified error code
25679c2e4b
2018-12-20 12:20:28 +03:00
Aleksey Kladov
a084412f06 set symbol index as const 2018-12-20 12:15:38 +03:00
Aleksey Kladov
6782fe2a5b Treat 2018-12-20 12:15:38 +03:00
Aleksey Kladov
97812c192a Restore library symbols 2018-12-20 12:15:38 +03:00
Aleksey Kladov
2d4582bfc6 fixme comment 2018-12-20 12:15:38 +03:00
Aleksey Kladov
2caac99ef3 resolve paths across crates 2018-12-20 12:15:38 +03:00
Aleksey Kladov
590bd5f849 workaround across-crate resolve bugs 2018-12-20 12:15:38 +03:00
Aleksey Kladov
2fe41574a1 fix tests 2018-12-20 12:15:38 +03:00
Aleksey Kladov
e6465e7e2a index all local crates 2018-12-20 12:15:38 +03:00
Aleksey Kladov
51fec4ef84 fix the test 2018-12-20 12:15:38 +03:00
Aleksey Kladov
1b946ef8a6 File can be opened before the root is scanned 2018-12-20 12:15:38 +03:00
Aleksey Kladov
7b6bafa631 fix syc 2018-12-20 12:15:38 +03:00
Aleksey Kladov
a5ef8ad05b swtich lsp server to vfs 2018-12-20 12:15:38 +03:00
Aleksey Kladov
6a755ed83a remove more imports 2018-12-20 12:15:38 +03:00
Aleksey Kladov
79596abcaf dead import 2018-12-20 12:15:38 +03:00
Aleksey Kladov
26dcc70129 fix hir mock 2018-12-20 12:15:38 +03:00
Aleksey Kladov
18aac1df45 kill file resolver 2018-12-20 12:15:38 +03:00
Aleksey Kladov
85290bc134 switch analysis to vfs 2018-12-20 12:15:38 +03:00
Aleksey Kladov
815a0e5778 doc comment 2018-12-20 12:15:38 +03:00
Aleksey Kladov
d0bab735c8 add root & path info to remove event 2018-12-20 12:15:38 +03:00
Aleksey Kladov
b6ce7a6d34 make it compile 2018-12-20 12:15:38 +03:00
Aleksey Kladov
dea1a69e1c remove relpath from input 2018-12-20 12:15:38 +03:00
Aleksey Kladov
cb6205c09d use relpaths for module resolve 2018-12-20 12:15:38 +03:00
Aleksey Kladov
a422d480a1 implement vfs events handling 2018-12-20 12:15:38 +03:00
Aleksey Kladov
e69b05781f add io::Task 2018-12-20 12:15:23 +03:00
Aleksey Kladov
99561cf2f2 Add type alias 2018-12-20 12:15:23 +03:00
Aleksey Kladov
2ae05a6163 vfs crate scaffold 2018-12-20 12:15:23 +03:00
Aleksey Kladov
7509901fa0 wip 2018-12-20 12:15:23 +03:00
Jeremy A. Kolb
93cf39d968 Bump languageserver-types to 0.53.0 to support LSP 3.14.0
See: https://microsoft.github.io/language-server-protocol/specification#version_3_14_0
2018-12-19 17:32:44 -05:00
bors[bot]
ef1e107df1 Merge #273
273: Add a test to ensure that we can parse each file r=matklad a=DJMcNab

Note that this has a non-spurious failure in ra_analysis/src/mock_analysis.

Probably fixes #195.

If my understanding is correct, fixes #214 and fixes #225.

Co-authored-by: DJMcNab <36049421+djmcnab@users.noreply.github.com>
2018-12-19 21:22:00 +00:00
DJMcNab
a3b842fb8b Add tests and only traverse in the crates directory 2018-12-19 21:19:32 +00:00
DJMcNab
db67741430 Move is_block to lower in the call tree 2018-12-19 20:55:24 +00:00
DJMcNab
def0a95d35 Revert "Revert to f6f7c5"
This approach is correct, but it needs an addition to Restrictions too

This reverts commit ad00d0c8a5f64142e6636e8b048204c8f8982f4a.
2018-12-19 20:12:18 +00:00
DJMcNab
4dce66ad31 Fix handling of structs in match arms 2018-12-19 20:12:18 +00:00
DJMcNab
cd8e33fb7e Revert to f6f7c5 2018-12-19 20:12:18 +00:00
DJMcNab
7a8560ba38 Fix expression parsing by bailing out upon a macro block being found
TODO: Fix this when the block like macro is in expression position

E.g. `test(test!{})` currently parses
2018-12-19 20:12:18 +00:00
DJMcNab
97e70bf50f Possibly fix #225 2018-12-19 20:12:18 +00:00
DJMcNab
29bf389034 Actually fix at_ts doc comment (committed wrong file :P) 2018-12-19 20:12:18 +00:00
DJMcNab
012537bd6c Fix at_ts doc comment 2018-12-19 20:12:18 +00:00
DJMcNab
20bbe0127c Fix parsing of inclusive ranges (#214)
I'm not certain that this is correct, so extra eyes would be good
2018-12-19 20:12:18 +00:00
DJMcNab
0b77eec922 Add a test to ensure that we can parse each file
Note that this has a non-spurious failure in ra_analysis/src/mock_analysis
2018-12-19 20:12:18 +00:00
Aleksey Kladov
1c5ce7a868 File module source does not depend on syntax 2018-12-19 01:51:05 +03:00
Aleksey Kladov
d20d788571 disable gc for now 2018-12-19 01:10:03 +03:00
Aleksey Kladov
e7aa17b560 Gc syntax trees after every modification 2018-12-19 00:35:13 +03:00
Aleksey Kladov
d05790b947 Work around a bug
cc #288
2018-12-18 14:58:54 +03:00
Aleksey Kladov
193992fd14 move thread worker to a separate crate 2018-12-18 12:52:17 +03:00
Andrew Chin
8b1e667077 By default, log only to stderr, and not to disk.
This fixes a common problem when running under VS Code, the user
doesn't have permissions to create a `log` directory in the CWD.

The old behavior can be re-enabled by setting RA_INTERNAL_MODE=1
2018-12-17 17:22:30 -05:00
Roland Ruckerbauer
d0f1334226 Fixed cast expression parsing in ra_syntax.
The cast expression expected any type via types::type_() function,
but the language spec does only allow TypeNoBounds (types without direct extra bounds
via `+`).

**Example:**

```rust
fn test() {
	6i8 as i32 + 5;
}
```

This fails, because the types::type_() function which should parse the type after the
as keyword is greedy, and takes all plus sign after path types as extra.

My proposed fix is to replace the not implemented `type_no_plus()` just calls (`type_()`)
function, which is used at several places. The replacement is `type_with_bounds_cond(p: &mut Parser, allow_bounds: bool)`, which passes the condition to relevant sub-parsers.

This function is then called by `type_()` and the new public `type_no_bounds()`.
2018-12-17 17:26:24 +01:00
Aleksey Kladov
8d42deeac3 fix installation on windows 2018-12-17 11:26:41 +03:00
Bernardo
0527e3b283 rename Edit to TextEdit and AtomEdit to AtomTextEdit 2018-12-11 19:07:17 +01:00
Bernardo
7344d28768 extract AtomEdit and Edit into new ra_text_edit crate 2018-12-10 22:09:12 +01:00
Bernardo
a062d844c2 use \b as word boundary 2018-12-09 15:50:56 +01:00
bors[bot]
3725276554 Merge #271
271: Implement format hook r=matklad a=DJMcNab

Tentatively: fixes #155.

However, this does add all changes in staged files, which might not be desirable. However, I think we can't solve that without explicit support in rustfmt for it, so it should be fine.

Co-authored-by: DJMcNab <36049421+djmcnab@users.noreply.github.com>
2018-12-09 12:44:58 +00:00
DJMcNab
cbce28a348 Reimplement format-hook using a rust binary 2018-12-09 12:27:13 +00:00
Aleksey Kladov
b9c17a6001 Answer canceled requests 2018-12-09 14:43:02 +03:00
Aleksey Kladov
5004cb928b verbose assertions in SourceFileItems 2018-12-09 14:21:54 +03:00
Aleksey Kladov
7784c7a701 resolve extern crates propertly 2018-12-09 13:49:54 +03:00
DJMcNab
279ff4927a Update hook to not add unstaged files 2018-12-09 10:37:04 +00:00
Aleksey Kladov
e89da32bb7 move tests to separate file 2018-12-09 13:33:16 +03:00
Aleksey Kladov
6a16d3fb0b WIP: resolve across crates 2018-12-09 13:33:16 +03:00
Aleksey Kladov
8b9ff46b37 make resolver fields private 2018-12-09 13:33:16 +03:00
Aleksey Kladov
74fe581061 return dependencies with names 2018-12-09 13:33:16 +03:00
Aleksey Kladov
961cae7e53 thread info about dep names 2018-12-09 13:33:16 +03:00
Aleksey Kladov
ca7e5905c1 more crate boilerplate 2018-12-09 13:33:16 +03:00
Aleksey Kladov
9c6c7ec2da hir::Crate boilerplate 2018-12-09 13:33:16 +03:00
Aleksey Kladov
9b1356464a propagate deps to CrateGraph 2018-12-09 13:33:16 +03:00
Aleksey Kladov
32c067f8c9 track deps in project model 2018-12-09 13:33:16 +03:00
DJMcNab
e823db0698 Implement and test format hook 2018-12-09 10:29:13 +00:00
Aleksey Kladov
159525b120 Check Fileid in SourceFileMap 2018-12-09 13:18:46 +03:00
Aleksey Kladov
13100da7a2 switch threadpool back from rayon to threadpool
rayon does not replenish the pool when the thread panics, but we must
be reselient to bugs.
2018-12-09 13:13:36 +03:00
bors[bot]
904438e993 Merge #267
267: Fix the extend keybinding r=DJMcNab a=DJMcNab

Make the extend selection keybinding less annoying for users not used to Injelli-J (myself included). Also fixes a minor style issue and runs `npm update`.

Co-authored-by: DJMcNab <36049421+djmcnab@users.noreply.github.com>
2018-12-09 09:09:07 +00:00
DJMcNab
bb0c2eb8d9 Fix cargo format component name and run rustfmt 2018-12-09 09:08:10 +00:00
DJMcNab
12addc6233 Add package command and upgrade event-stream 2018-12-08 21:09:32 +00:00
Bernardo
6fb267f5da find next whitespace or begining or end 2018-12-08 20:53:03 +01:00
bors[bot]
97b07ac393 Merge #265
265: Refactor symbol resolve API r=matklad a=matklad

Introduce ReferenceResolution to avoid nesting to many non-nominal
types.

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2018-12-08 18:20:11 +00:00
Aleksey Kladov
7fd6a41127 Refactor symbol resolve API
Introduce ReferenceResolution to avoid nesting to many non-nominal
types.
2018-12-08 21:18:29 +03:00
bors[bot]
51f669606c Merge #263
263: New modules r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2018-12-08 17:55:17 +00:00
Aleksey Kladov
7a79cde107 account for new layout when collecting tests 2018-12-08 20:54:44 +03:00
bors[bot]
5ad7547ce2 Merge #264
264: check for empty range when extending in comment r=matklad a=vemoo

fix for #140 

Co-authored-by: Bernardo <berublan@gmail.com>
2018-12-08 17:43:15 +00:00
Bernardo
c22e901403 check for empty range when extending in comment 2018-12-08 18:26:19 +01:00
Aleksey Kladov
4cbc902fcc grand module rename 2018-12-08 19:30:35 +03:00
Aleksey Kladov
93c0b7d794 resolve 2018 style modules 2018-12-08 19:28:35 +03:00
Aleksey Kladov
e096867ada reformat 2018-12-08 19:28:24 +03:00
DJMcNab
f88e0700e6 Add a better text for hover and stop duplicating work done in approximatelly_resolve_symbol 2018-12-08 19:28:10 +03:00
DJMcNab
6d548d944f Fix typo in comment 2018-12-08 19:28:10 +03:00
DJMcNab
89cf7d8743 Clarify and correct comment about multi_byte_tokens 2018-12-08 19:28:10 +03:00
DJMcNab
3d3026dc60 Fix the range of a hover request to be more in line with prior art 2018-12-08 19:28:10 +03:00
Florian Diebold
29793e7de9 Add test for code actions 2018-12-06 21:32:15 +01:00
Florian Diebold
1dfd06fc8a Use json comparison code from cargo for heavy tests 2018-12-06 21:32:15 +01:00
Aleksey Kladov
28ddecf6c9 modernize even more 2018-12-06 21:16:37 +03:00
Aleksey Kladov
f6e8b376d1 modernize more 2018-12-06 21:03:39 +03:00
Aleksey Kladov
e477b87455 drop extern crates 2018-12-06 20:50:16 +03:00
Aleksey Kladov
1761a7d213 modernize some files 2018-12-06 20:49:36 +03:00
Aleksey Kladov
49324ee566 modernize some code 2018-12-06 20:42:03 +03:00
bors[bot]
25cf2349ab Merge #256
256: Improve/add use_item documentation r=matklad a=DJMcNab

Adds some documentation to use_item explaining all code paths (use imports are hard, especially with the ongoing discussion of anchored v. uniform paths - see https://github.com/rust-lang/rust/issues/55618 for what appears to be the latest developments)

Co-authored-by: DJMcNab <36049421+djmcnab@users.noreply.github.com>
2018-12-06 17:30:36 +00:00
Aleksey Kladov
ce6c26a60e ⬆️ 1.31.0 🎉 2018-12-06 20:22:06 +03:00
DJMcNab
455ef940fe Update use path test 2018-12-05 22:08:00 +00:00
bors[bot]
e9060db158 Merge #253
253: Fix diagnostic fixes showing up everywhere r=matklad a=flodiebold

The LSP code action request always returned the fixes for all diagnostics anywhere in the file, because of a shadowed variable.


There's no test yet; I wasn't sure where to add it. I tried adding one in `heavy_tests`, but that's a bit uncomfortable because the code action response contains the (random) file paths. I could make it work, but wanted to ask beforehand what you think.

Co-authored-by: Florian Diebold <flodiebold@gmail.com>
2018-12-05 22:04:34 +00:00
DJMcNab
5da245ec33 Fix a copy and pasting typo 2018-12-05 21:46:43 +00:00
DJMcNab
0a82d768c4 Improve/add the use_item documentation 2018-12-05 21:43:40 +00:00
Aleksey Kladov
0b1c0ee225 First step towards crate deps 2018-12-05 16:01:18 +03:00
Aleksey Kladov
7ef1697df8 make stuff private 2018-12-05 15:31:40 +03:00
Aleksey Kladov
db456749a8 make stuff private 2018-12-05 13:20:11 +03:00
Aleksey Kladov
4344264024 move fuzzy source binding to a separete mode 2018-12-05 13:16:20 +03:00
Aleksey Kladov
7960c8b276 restore index-based gotodef 2018-12-05 12:17:38 +03:00
Aleksey Kladov
54d053c881 minor 2018-12-04 23:52:14 +03:00
Aleksey Kladov
d8b0379e10 Add functions to DefId 2018-12-04 23:44:00 +03:00
Aleksey Kladov
947e3350e0 module-scoped defloc 2018-12-04 23:01:53 +03:00
Aleksey Kladov
45fce90349 ModuleSource is ItemSource 2018-12-04 22:46:23 +03:00
Aleksey Kladov
a9e4142f43 include file itself in SourceFileItems 2018-12-04 21:21:39 +03:00
Florian Diebold
d0811c4066 Fix diagnostic fixes showing up everywhere
The LSP code action request always returned the fixes for all diagnostics
anywhere in the file, because of a shadowed variable.
2018-12-02 20:58:16 +01:00
bors[bot]
244f9a142f Merge #250
250: Improve the suggestion for test functions r=DJMcNab a=DJMcNab

I haven't fully updated the previous commented out test - I don't know why it was commented out so some clarification would be welcome.

Co-authored-by: Daniel McNab <36049421+djmcnab@users.noreply.github.com>
Co-authored-by: DJMcNab <36049421+djmcnab@users.noreply.github.com>
2018-12-02 14:58:32 +00:00
DJMcNab
224e0cee5a Fix formatting 2018-12-02 14:57:54 +00:00
bors[bot]
0bdf8deb77 Merge #252
252: Improve 'introduce variable' r=matklad a=flodiebold

 - make it possible to extract a prefix of an expression statement (e.g.
   `<|>foo.bar()<|>.baz()`)
 - don't turn the last expression in a block into a let statement
 - also fix a few typos

Co-authored-by: Florian Diebold <flodiebold@gmail.com>
2018-12-02 13:08:16 +00:00
Florian Diebold
2706456832 Improve 'introduce variable'
- make it possible to extract a prefix of an expression statement (e.g.
   <|>foo.bar()<|>.baz())
 - don't turn the last expression in a block into a let statement
2018-12-02 14:00:46 +01:00
Aleksey Kladov
bcc2342be6 Put derive back
It is used in this file
2018-12-02 12:27:30 +03:00
Aleksey Kladov
edd3768a44 Add derive after doc comments 2018-12-02 12:19:22 +03:00
Jeremy A. Kolb
ab7843c2d1 Put map back 2018-11-30 09:39:30 -05:00
Jeremy A. Kolb
f32dc71351 Clippy lints 2018-11-29 15:30:49 -05:00
Daniel McNab
3dea87b054 Format completion text properly 2018-11-28 22:02:53 +00:00
Daniel McNab
f988441904 Add tfn lookup and remove test prefix 2018-11-28 18:39:33 +00:00
Aleksey Kladov
70a7cb34ec switch to released id-arena 2018-11-28 21:03:30 +03:00
Daniel McNab
b47a88be9c Change the body and name of the test function completion 2018-11-28 17:04:03 +00:00
Aleksey Kladov
555483d397 drop comment 2018-11-28 16:27:43 +03:00
Aleksey Kladov
af7a0596f6 remove useless test hooks 2018-11-28 16:25:56 +03:00
Aleksey Kladov
d30bbfda74 make a bunch of stuff private 2018-11-28 16:24:06 +03:00
Aleksey Kladov
e89700f967 Move hir tests to hit 2018-11-28 16:19:01 +03:00
Aleksey Kladov
59e29aef63 Move hir to a separate crate 2018-11-28 04:09:44 +03:00
Aleksey Kladov
0e4b710af8 introduce hir crate 2018-11-28 03:42:26 +03:00
Aleksey Kladov
f66e5b6e6b move ids to HIR 2018-11-28 03:31:50 +03:00
Aleksey Kladov
11168c464c move db basics to ra_db
This should allow to move hir to a separate crate
2018-11-28 03:25:20 +03:00
Aleksey Kladov
b2de95879a generalize location interner 2018-11-28 02:49:28 +03:00
Aleksey Kladov
ec45dfea1e rename file_syntax -> source_file 2018-11-28 02:25:03 +03:00
Aleksey Kladov
65c064b2a9 introduce SymbolsDatabase 2018-11-28 02:22:25 +03:00
Aleksey Kladov
201aa7ea2a remove syntax ptr 2018-11-28 02:15:21 +03:00
Aleksey Kladov
c2abd17f57 Use ItemPtr for id 2018-11-28 02:13:52 +03:00
Aleksey Kladov
3922503205 ItemId based module source 2018-11-28 02:09:09 +03:00
Aleksey Kladov
9027a21f9a Introduce SourceItemId 2018-11-28 01:53:54 +03:00
Aleksey Kladov
00df339c41 rename 2018-11-28 01:48:43 +03:00
Aleksey Kladov
5e7f4202cf Move FileItems up 2018-11-28 01:45:36 +03:00
Aleksey Kladov
b9100d769a Remove unused dead code 2018-11-28 01:41:10 +03:00
Aleksey Kladov
4c9933c016 check_canceled is a method 2018-11-28 01:38:39 +03:00
Aleksey Kladov
806ea03b64 drop descriptor suffix, use hir:: instead 2018-11-28 01:22:17 +03:00
Aleksey Kladov
36b1d20c16 rename ModuleDescriptor -> Module 2018-11-28 01:19:55 +03:00
Aleksey Kladov
16f67ee384 move resolve_local to Scopes 2018-11-28 01:11:29 +03:00
Aleksey Kladov
7207eef716 rename FnDescriptior -> FnSignatureInfo 2018-11-27 23:48:24 +03:00
Aleksey Kladov
67de38ec7d move resolve_local_scope 2018-11-27 23:40:23 +03:00
Aleksey Kladov
93fae08261 make module module private 2018-11-27 23:35:53 +03:00
Aleksey Kladov
b7049ea543 move query definitions 2018-11-27 23:33:36 +03:00
Aleksey Kladov
90bc832b22 remove underscores 2018-11-27 23:05:33 +03:00
Aleksey Kladov
f14902f67b move hir db 2018-11-27 23:03:08 +03:00
Aleksey Kladov
109a7f3717 itroduce FunctionDescriptor 2018-11-27 22:58:09 +03:00
Aleksey Kladov
f4d0cb64fc rename descriptorsdb -> hirdb 2018-11-27 21:58:44 +03:00
Aleksey Kladov
d659b7a2f0 start descriptors -> hir rename 2018-11-27 21:45:42 +03:00
Aleksey Kladov
192e2bbb0e resolve_path works with DefIds 2018-11-27 19:56:03 +03:00
Aleksey Kladov
aa7fd563a4 use ctry 2018-11-27 18:45:16 +03:00
Aleksey Kladov
f4860870da scope-based resolve path 2018-11-27 18:25:35 +03:00
Aleksey Kladov
68f66e0f44 add db to resolve_path 2018-11-27 18:25:35 +03:00
Aleksey Kladov
5b0e347f89 Make resolve_path cancelable 2018-11-27 18:25:35 +03:00
Aleksey Kladov
6bb06addf8 don't use volatile queries
"volatile" means "changes every time". That is, all transitive
rev-deps of volatile queries will be executed every time. We actually
need "dependencies".
2018-11-27 17:39:58 +03:00
Aleksey Kladov
10f4d4b74c Make nameresolution resilient to reparsing
We now store item id's instead of local syntax ptrs, and item ids
don't change if you type inside a single function.
2018-11-27 15:02:06 +03:00
Aleksey Kladov
4d87799a4a implement file_items 2018-11-27 15:01:52 +03:00
Aleksey Kladov
16cdd126b6 add file items query 2018-11-27 15:01:52 +03:00
bors[bot]
8e37208040 Merge #244
244: Switch to id-arena r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2018-11-27 11:23:29 +00:00
Aleksey Kladov
ed023929d5 Switch to id-arena 2018-11-27 14:23:06 +03:00
Aleksey Kladov
6b1f30ade9 hack around nested libraries 2018-11-27 00:12:43 +03:00
Aleksey Kladov
b6fcd46278 Codify Arena pattern 2018-11-25 19:02:14 +03:00
Aleksey Kladov
ebc4e75253 switch back to the latest beta 2018-11-24 21:52:49 +03:00
Aleksey Kladov
955d2eea45 add test loggin API to db 2018-11-21 20:44:05 +03:00
Aleksey Kladov
e8c50f0915 Use : as a trigger character for completion
Note that VSCode asks for completion after *first* `:` as well:

    use crate:

we use hacks to protect against that, and to give completions only
after the second `:`.
2018-11-21 19:06:48 +03:00
Aleksey Kladov
edeec6a414 Complete paths after :: 2018-11-21 18:34:20 +03:00
Aleksey Kladov
7ffc7d3308 Move path completion to descriptors 2018-11-21 18:20:44 +03:00
Aleksey Kladov
11f19b7849 name res uses paths 2018-11-21 17:51:02 +03:00
Aleksey Kladov
5a87a24f82 move Path 2018-11-21 17:18:26 +03:00
Aleksey Kladov
18000ba864 docs 2018-11-21 17:07:44 +03:00
Aleksey Kladov
d47075af52 move path to descriptors 2018-11-21 16:16:54 +03:00
Aleksey Kladov
8954d4dc67 Introduce Import struct 2018-11-21 16:15:15 +03:00
Aleksey Kladov
82c088137a Remove import_resolutions
It's cheaper to re-query this info anyway
2018-11-21 16:02:34 +03:00
Aleksey Kladov
5a61b218f8 Pin to older beta
https://github.com/rust-lang/rust/issues/56128
2018-11-21 14:47:19 +03:00
Aleksey Kladov
049f8df93c switch completion to new scope 2018-11-21 12:57:05 +03:00
Aleksey Kladov
b70b6bce19 Move to top 2018-11-21 11:35:25 +03:00
Aleksey Kladov
ff75ad13a4 Measure time 2018-11-21 11:18:43 +03:00
Aleksey Kladov
02c4f82348 simple test for item map 2018-11-21 11:16:46 +03:00
Aleksey Kladov
36aad85138 add item map query 2018-11-21 00:39:50 +03:00
Aleksey Kladov
9bb11aee44 populate resolve from unresolved imports 2018-11-21 00:31:12 +03:00
Aleksey Kladov
aab71bff8e move to method 2018-11-20 23:36:53 +03:00
Aleksey Kladov
cc8163439f populate modules 2018-11-20 21:50:22 +03:00
Aleksey Kladov
1cf92c3e28 remember spans with paths 2018-11-20 21:17:14 +03:00
Aleksey Kladov
c54b51fded add DefId 2018-11-20 21:12:15 +03:00
Aleksey Kladov
8086107b6a implement path conversion 2018-11-20 19:40:37 +03:00
Aleksey Kladov
bcdcfa9df2 Some import resolution boilerplate 2018-11-20 19:24:58 +03:00
Aleksey Kladov
5f8068cea8 make mod private 2018-11-20 18:34:10 +03:00
Aleksey Kladov
a2fdb41ace fix typo 2018-11-20 17:33:27 +03:00
Aleksey Kladov
8fc51501e0 Remove ModId 2018-11-20 17:23:17 +03:00
Aleksey Kladov
1913bedc2e Make more stuff private 2018-11-20 17:21:00 +03:00
Aleksey Kladov
a300fb68e2 Make most of modules impl private 2018-11-20 17:16:33 +03:00
Aleksey Kladov
0dd26a2f5b Use OO module API in completion 2018-11-20 17:08:40 +03:00
Aleksey Kladov
21508cfb2f Use OO API instead of resolve_module 2018-11-20 16:55:35 +03:00
Aleksey Kladov
0ab3c65d98 Use OO API in crate_for 2018-11-20 16:40:15 +03:00
Aleksey Kladov
d475e3b29f Make LikdId private 2018-11-20 16:24:47 +03:00
Aleksey Kladov
3b8d0c215a Use more OO API for parent module 2018-11-20 16:21:02 +03:00
Aleksey Kladov
099da13f53 Make some queries private
Convention: we prefix private queries with `_` until salsa support
real visibility.
2018-11-20 14:58:01 +03:00
Aleksey Kladov
4e683d7af1 Add ModId 2018-11-20 14:52:10 +03:00
Aleksey Kladov
4e48917c00 use loc2id for FnIds 2018-11-18 16:21:23 +03:00
Aleksey Kladov
cb22a799d6 Add Loc2IdMap 2018-11-18 15:44:24 +03:00
Adolfo Ochagavía
acd51cb361 cargo format 2018-11-16 12:16:20 +01:00
Adolfo Ochagavía
bccbee5ba3 Rename col to col_utf16 2018-11-16 12:15:50 +01:00
Adolfo Ochagavía
136d1864bc Support UTF-16 chars in LineIndex 2018-11-16 12:15:50 +01:00
Adolfo Ochagavía
c96bfe7e2d Split string lexing and run rustfmt 2018-11-11 21:00:31 +01:00
Adolfo Ochagavía
30cd4d5acb Validate byte string literals 2018-11-11 20:41:43 +01:00
Adolfo Ochagavía
c258b4fdb0 Add validator for byte 2018-11-11 20:27:00 +01:00
Adolfo Ochagavía
a4f7d7a7cd Fix typos 2018-11-11 19:28:55 +01:00
Adolfo Ochagavía
3b4c02c19e Validate string literals 2018-11-09 14:52:17 +01:00
Aleksey Kladov
8475c962a0 Fix the test 2018-11-08 18:54:19 +03:00
Aleksey Kladov
00e80b24e3 workspace-symbols function for Emacs 2018-11-08 18:43:02 +03:00
Aleksey Kladov
c69ff08dc9 eglot worksapce symbol 2018-11-08 17:40:24 +03:00
Aleksey Kladov
6d253b58da Complete paths in use trees 2018-11-07 21:38:41 +03:00
Aleksey Kladov
06fbc6e3ed Do more work in classify 2018-11-07 21:17:18 +03:00
Aleksey Kladov
397c235086 Use cached module scopes for completion 2018-11-07 21:08:11 +03:00
Aleksey Kladov
9b88ec488b split completion mod 2018-11-07 20:34:16 +03:00
Aleksey Kladov
af17fc9697 reorganize completion 2018-11-07 19:50:17 +03:00
Aleksey Kladov
22949dab26 rename module source 2018-11-07 18:42:36 +03:00
Aleksey Kladov
2ed1514df3 rename ROOT -> SOURCE_FILE 2018-11-07 18:42:36 +03:00
Aleksey Kladov
f8b36bbc3b Rename File -> SourceFileNode 2018-11-07 18:42:36 +03:00
Jeremy A. Kolb
2119fe2143 Cargo update 2018-11-07 18:42:09 +03:00
Jeremy A. Kolb
c29f158c20 Rustfmt to pass CI 2018-11-07 18:24:55 +03:00
Jeremy A. Kolb
a83ed374d0 Remove unused variable 2018-11-07 18:24:55 +03:00
Jeremy A. Kolb
8ccd26adf3 Show documentation for hover requests 2018-11-07 18:24:55 +03:00
Jeremy A. Kolb
6df71da81f Add some more DocCommentsOwner 2018-11-07 18:24:55 +03:00
bors[bot]
2e2445444a Merge #207
207: Finish implementing char validation r=aochagavia a=aochagavia

The only thing missing right now are good integration tests (and maybe more descriptive error messages)

Co-authored-by: Adolfo Ochagavía <github@adolfo.ochagavia.xyz>
2018-11-07 11:09:40 +00:00
Adolfo Ochagavía
433a806191 Fix backslash escape 2018-11-07 12:04:26 +01:00
Adolfo Ochagavía
3b2ba59526 Use ArrayString instead of hand rolled data structure 2018-11-07 11:58:34 +01:00
Adolfo Ochagavía
e37ba706cc cargo format 2018-11-07 11:41:42 +01:00
Adolfo Ochagavía
94796e6447 Add lots of tests 2018-11-07 11:35:33 +01:00
Adolfo Ochagavía
fdb9f06880 Store hex digits in a stack-allocated buffer 2018-11-07 10:40:58 +01:00
Aleksey Kladov
8eaf7952ae ra_syntax::File is just RootNode 2018-11-06 23:26:26 +03:00
Aleksey Kladov
7f88fe8790 Add a pinch of comments 2018-11-06 22:06:58 +03:00
Aleksey Kladov
a5301e94d5 Generalize Owned nodes 2018-11-06 21:52:00 +03:00
Aleksey Kladov
ec131b6c7b grammar: fix where clause parsing
closes #205
2018-11-06 21:19:32 +03:00
Aleksey Kladov
dafe747dcc upstream basic tree algorithms to rowan 2018-11-06 20:56:32 +03:00
Adolfo Ochagavía
c56db92d1f Finish implementing char validation 2018-11-06 17:07:27 +01:00
Jeremy A. Kolb
5a9d471f98 Use closing paren as a trigger character
This seems counter-intuitive based on the concept of "trigger character"
but it provides a better function signature experience.
2018-11-05 17:13:56 -05:00
bors[bot]
f605f6e70a Merge #188
188: Introduce `SyntaxErrorKind` and `TextRange` to `SyntaxError` r=matklad a=aochagavia



Co-authored-by: Adolfo Ochagavía <aochagavia92@gmail.com>
Co-authored-by: Adolfo Ochagavía <github@adolfo.ochagavia.xyz>
2018-11-05 21:32:25 +00:00
Adolfo Ochagavía
59405bfe4a cargo format 2018-11-05 22:29:33 +01:00
Adolfo Ochagavía
fda8ddc5fe Introduce Location and make SyntaxError fields private 2018-11-05 18:38:34 +01:00
Aleksey Kladov
43665eb166 bring back testutils 2018-11-05 15:56:07 +03:00
Aleksey Kladov
8e8f52e80a add description 2018-11-05 15:52:22 +03:00
Aleksey Kladov
80e50cae00 Switch ra_syntax to 2015 edition 2018-11-05 15:47:59 +03:00
Aleksey Kladov
420725f256 Introduce var works with tail exprs 2018-11-05 15:44:34 +03:00
Aleksey Kladov
0192c116f7 Use FilePosition everywhere 2018-11-05 14:57:41 +03:00
Aleksey Kladov
1e1c188cbf rename Position to FilePostion 2018-11-05 14:24:38 +03:00
Aleksey Kladov
8b132354bb don't send backtraces for canceled requests 2018-11-05 14:22:39 +03:00
Aleksey Kladov
6bbcfca7ae Fully add inline modules to module tree 2018-11-05 14:10:20 +03:00
Aleksey Kladov
44d8919384 Submodule is enum 2018-11-05 13:23:37 +03:00
Aleksey Kladov
17a88928f4 collect all submodules 2018-11-05 13:08:52 +03:00
Aleksey Kladov
e0b21b9899 submodules works with module sources 2018-11-05 12:36:38 +03:00
Aleksey Kladov
88a15d10d5 use module_for_source 2018-11-05 12:36:38 +03:00
Aleksey Kladov
cd878658d3 Introduce modules_from_source fn 2018-11-05 12:36:38 +03:00
Aleksey Kladov
6502bd2c96 reduce code duplication 2018-11-05 11:39:51 +03:00
Aleksey Kladov
9010cb9839 grammar: for predicates in where
closes #191
2018-11-05 11:24:08 +03:00
Adolfo Ochagavía
3b42ddae60 Introduce SyntaxErrorKind and TextRange in SyntaxError 2018-11-04 21:16:38 +01:00
Adolfo Ochagavía
9b5bbab104 Add character literal parsing and validation 2018-11-04 15:17:24 +01:00
Aleksey Kladov
f29b0172fb Use Default everywhere 2018-11-04 14:09:21 +03:00
Aleksey Kladov
cca5f862de Don't order import alphabetical
alphabetical ordering is no more consistent, and much less useful then
the ordering which arises naturally when you add import.
2018-11-01 16:18:53 +03:00
Aleksey Kladov
c74e86536e Dead code 2018-11-01 16:00:13 +03:00
Aleksey Kladov
a17b41033a update salsa 2018-11-01 15:30:07 +03:00
Aleksey Kladov
962a491829 Some docs 2018-11-01 14:31:35 +03:00
Aleksey Kladov
f2b654fd44 Add inline source 2018-11-01 13:51:44 +03:00