Commit graph

761 commits

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