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
Aleksey Kladov
223fd2979c
Introduce ModuleSource
2018-11-01 13:41:58 +03:00
Aleksey Kladov
d685a9b564
Use From to get an owned AST
2018-11-01 13:41:20 +03:00
bors[bot]
3ec9f958b3
Merge #179
...
179: Remove DOC_COMMENT r=matklad a=kjeremy
Closes #166
Co-authored-by: Jeremy A. Kolb <jkolb@ara.com>
2018-11-01 10:16:24 +00:00
Aleksey Kladov
2050812cad
remove SyntaxPtrDatabase
2018-11-01 13:15:11 +03:00
Jeremy A. Kolb
61580f3cb8
Remove DOC_COMMENT
...
Closes #166
2018-10-31 17:38:18 -04:00
Aleksey Kladov
2b210d98b8
Fix test
2018-11-01 00:00:43 +03:00
Aleksey Kladov
fabb804f30
Speedup fmt
2018-10-31 23:58:03 +03:00
Aleksey Kladov
8f1a83b4cb
RemoveDeadCode
2018-10-31 23:50:18 +03:00
Aleksey Kladov
6be50f7d5d
Reformat all
2018-10-31 23:41:43 +03:00
Muhammad Mominul Huque
857c1650ef
Various changes
...
Pin to a specific toolchain version
Format checking functionality
Add a test to check the code formatting.
Remove macro_use attribute
2018-10-31 23:39:21 +03:00
Muhammad Mominul Huque
d14610dab4
initial implementation
2018-10-31 23:39:21 +03:00
Jeremy A. Kolb
9b9fc135d6
Simplify find_all_refs by always resolving a ast::BindPat
2018-10-31 23:38:22 +03:00
Jeremy A. Kolb
406f366ccc
Add DeclarationDescriptor and ReferenceDescriptor
...
Fixes #142
Fixes #146
2018-10-31 23:30:57 +03:00
bors[bot]
55ebe6380a
Merge #167
...
167: Attempt to extract useful comments from function signatures r=matklad a=kjeremy
I'm trying to extract useful function comments for signature info. This will also be useful for hover. This is a WIP (and actually works pretty well!) but I don't think it's the right approach long term so some guidance would be appreciated so that we could also get comments for say types and variable instances etc.
Currently `test_fn_signature_with_simple_doc` fails due to a bug in `extend` but we probably shouldn't use this approach anyway. Maybe comments should be attached to nodes somehow? I'm also thinking that maybe the markdown bits should live in the language server.
Thoughts?
Co-authored-by: Jeremy A. Kolb <jkolb@ara.com>
2018-10-31 19:41:24 +00:00
Aleksey Kladov
dfba29e4fb
Add MockAnalysis to make testing easier
2018-10-31 22:35:01 +03:00
Jeremy A. Kolb
74320945b6
Make extend private again
2018-10-31 15:27:35 -04:00
Jeremy A. Kolb
05eb489ec5
Useful comments from function signatures
2018-10-31 15:23:20 -04:00
Jeremy A. Kolb
d2bcd1a386
ast::DocCommentsOwner
which represents a documentation comment owner
2018-10-31 15:08:37 -04:00
Jeremy A. Kolb
3c2aefc274
Prevent panic by initializing LibrariesQuery
2018-10-31 14:53:09 -04:00
Aleksey Kladov
64ce895ef0
extract fixture parsing
2018-10-31 21:37:40 +03:00
bors[bot]
b58ca6b1a6
Merge #177
...
177: Librariese -> Libraries r=matklad a=kjeremy
Co-authored-by: Jeremy A. Kolb <jkolb@ara.com>
2018-10-31 18:16:58 +00:00
Jeremy A. Kolb
542fbcbaed
Fix typo
2018-10-31 14:05:14 -04:00
bors[bot]
1dc5608d0b
Merge #176
...
176: Move completio to ra_analysis r=matklad a=matklad
While we should handle completion for isolated file, it's better
achieved by using empty Analysis, rather than working only with &File:
we need memoization for type inference even inside a single file.
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2018-10-31 18:05:12 +00:00
Jeremy A. Kolb
e60ef6260f
Fix typos
2018-10-31 21:04:38 +03:00
Aleksey Kladov
c09e14a4ff
remove old completion
2018-10-31 21:03:00 +03:00
Aleksey Kladov
f3fb59d707
Move completion to ra_analysis
...
While we should handle completion for isolated file, it's better
achieved by using empty Analysis, rather than working only with &File:
we need memoization for type inference even inside a single file.
2018-10-31 21:01:51 +03:00
Aleksey Kladov
c02be1502c
move resolve local name
2018-10-31 15:13:49 +03:00
Aleksey Kladov
b67295134b
Move FnDescriptors to analyzer
2018-10-31 10:56:31 +03:00
Aleksey Kladov
3068af79ff
Introduce owned ast nodes
...
ast::FooNode is an owned 'static counterpart to ast::Foo<'a>
2018-10-31 10:29:32 +03:00
bors[bot]
032d15c392
Merge #171
...
171: Query-based module scopes r=matklad a=matklad
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2018-10-30 23:10:48 +00:00
Aleksey Kladov
fbbee53722
Add ModuleScope as a query
...
This is a first step towards queryifing completion and resolve.
Some code currently duplicates ra_editor: the plan is to move all
completion from ra_editor, but it'll take more than one commit.
2018-10-31 02:08:54 +03:00
Aleksey Kladov
23cad90fe9
⬆️ salsa
2018-10-31 01:22:47 +03:00
bors[bot]
d10214581e
Merge #168
...
168: Fix param number r=matklad a=kjeremy
Fixes the parameter number if we are not in a method
Co-authored-by: Jeremy A. Kolb <jkolb@ara.com>
2018-10-30 21:50:51 +00:00
Aleksey Kladov
1643d94a65
switch to TextRange::subrange
2018-10-30 21:26:55 +03:00
Aleksey Kladov
950e8b8182
introduce syntax-ptr
2018-10-30 21:23:23 +03:00
Jeremy A. Kolb
93dc703011
Fix param number
2018-10-30 14:09:53 -04:00
Aleksey Kladov
bc4de7128f
gc syntax trees
2018-10-29 13:58:11 +03:00
Aleksey Kladov
35568cf057
Index files in parallel
2018-10-29 13:32:45 +03:00
Aleksey Kladov
363adf07b7
restore symbols filtering
2018-10-25 17:59:03 +03:00
Aleksey Kladov
d190019571
Move input to top-level
2018-10-25 17:52:50 +03:00
Aleksey Kladov
5ef3fda5e1
Remove unneded Hash
2018-10-25 17:43:17 +03:00
Aleksey Kladov
e7217e1a01
dead code
2018-10-25 17:42:29 +03:00
Aleksey Kladov
3c024d6c62
dead code
2018-10-25 17:41:17 +03:00
Aleksey Kladov
e0eb33605a
Encapsulate CrateGraph a bit
2018-10-25 17:40:24 +03:00
Aleksey Kladov
75d9cbd7c2
re-enable cancelation
2018-10-25 17:22:31 +03:00
Aleksey Kladov
772acb53f2
use correct file when resolving callables
2018-10-25 16:25:40 +03:00
Aleksey Kladov
171acad15b
disable cancelation
2018-10-25 16:25:40 +03:00
Aleksey Kladov
56df0fc83c
Improve logging
2018-10-25 16:25:40 +03:00
Aleksey Kladov
ee4d904cfb
Store all the data in the Salsa Database
2018-10-25 16:25:40 +03:00
Aleksey Kladov
bca5a41dff
Fix the test
2018-10-25 13:47:31 +03:00
Aleksey Kladov
48fa1f8ba0
More informative lable for check runnable
2018-10-25 11:01:37 +03:00
Aleksey Kladov
6660101554
specify package when running cargo check
2018-10-25 10:56:12 +03:00
Aleksey Kladov
0e359af291
Always add cargo check as a runnable
2018-10-25 10:29:39 +03:00
Aleksey Kladov
69d07df201
Complete crate:: paths
2018-10-24 18:37:25 +03:00
Aleksey Kladov
9a7db8fa00
simplify roots
2018-10-24 17:25:10 +03:00
Aleksey Kladov
8ada1a2689
Simplify
2018-10-24 16:36:28 +03:00
Aleksey Kladov
44c8ddf885
make indexing parallel again
2018-10-24 16:13:17 +03:00
Aleksey Kladov
b636d23bec
revive the test
2018-10-24 15:00:03 +03:00
bors[bot]
ffbb604363
Merge #157
...
157: Introduce ModuleId r=matklad a=matklad
Previously, module was synonym with a file, and so a module could have
had several parents. This commit introduces a separate module concept,
such that each module has only one parent, but a single file can
correspond to different modules.
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2018-10-23 17:57:10 +00:00
Aleksey Kladov
dc477db757
Introduce ModuleId
...
Previously, module was synonym with a file, and so a module could have
had several parents. This commit introduces a separate module concept,
such that each module has only one parent, but a single file can
correspond to different modules.
2018-10-23 20:44:23 +03:00
bors[bot]
e49c628c0d
Merge #156
...
156: Cargo Update run r=kjeremy a=kjeremy
Bump relative-path to 0.4.0
Failure 0.1.3 to fix leak with downcast
Updated everything else too
Co-authored-by: Jeremy A. Kolb <jkolb@ara.com>
2018-10-23 13:59:56 +00:00
Jeremy A. Kolb
0ee37099b5
Cargo Update run
...
Bump relative-path to 0.4.0
Failure 0.1.3 to fix leak with downcast
Updated everything else too
2018-10-23 09:46:00 -04:00
Aleksey Kladov
1d574ed654
complete pub(crate)
2018-10-23 16:42:07 +03:00
bors[bot]
ed736b1ac1
Merge #153
...
153: Restore folding import groups r=matklad a=aochagavia
Closes #133
Co-authored-by: Adolfo Ochagavía <github@adolfo.ochagavia.xyz>
2018-10-23 13:28:05 +00:00
Adolfo Ochagavía
7ee10b073e
Restore folding import groups
2018-10-23 14:58:02 +02:00
bors[bot]
0043d7e9c7
Merge #151
...
151: Add LspError to explicity return errors from LSP handlers r=matklad a=kjeremy
Fixes #145
Co-authored-by: Jeremy A. Kolb <jkolb@ara.com>
2018-10-23 12:28:57 +00:00
bors[bot]
fd7f6beedc
Merge #152
...
152: Fix typo r=matklad a=kjeremy
Co-authored-by: Jeremy A. Kolb <jkolb@ara.com>
2018-10-22 22:00:42 +00:00
bors[bot]
27694abd94
Merge #138
...
138: Fix some clippy lints r=matklad a=alanhdu
I went ahead and fixed all the clippy lints (there were a couple I thought would be better unfixed and added `cfg` statements to allow them) and also re-enabled clippy and rustfmt in CI.
They were disabled with `no time to explain, disable clippy checks`, so hopefully this won't go against whatever the reason at the time was 😆 .
One question about the CI though: right now, it's an allowed failure that runs against the latest nightly each time. Would it be better to pin it to a specific nightly (or use the `beta` versions) to lower the churn?
Co-authored-by: Alan Du <alanhdu@gmail.com>
2018-10-22 21:14:38 +00:00
Jeremy A. Kolb
652afa17ad
Fix typo
2018-10-22 13:55:17 -04:00
Jeremy A. Kolb
6453b29cb5
Add LspError to explicity return errors from LSP handlers
...
Fixes #145
2018-10-22 13:49:27 -04:00
Alan Du
dc9ce8ff74
Rename new to new_item (to match new_impl)
2018-10-22 10:50:55 -04:00
Aleksey Kladov
dbe2880219
cleanup
2018-10-20 23:27:06 +03:00
Aleksey Kladov
0102a01f76
Remove job handle
2018-10-20 22:59:54 +03:00
Aleksey Kladov
8bb4380448
Fix tests
2018-10-20 22:43:36 +03:00
Aleksey Kladov
6e88aaef5d
use pythonic import order
...
use std
// blank line
use extern crates
// blank line
use crate::{}
2018-10-20 22:38:52 +03:00
Aleksey Kladov
8eea10e3ab
actually check for cancelation
2018-10-20 22:35:55 +03:00
Aleksey Kladov
71cbdddf1c
make file-symbols query cancelable
2018-10-20 22:29:26 +03:00
Aleksey Kladov
e74bf6e56e
mark module queries as cacelable
2018-10-20 22:15:03 +03:00
Aleksey Kladov
9fb41716de
make more things cancelable
2018-10-20 22:09:12 +03:00
Aleksey Kladov
998f2ae762
remove job tokens
2018-10-20 22:02:41 +03:00
Aleksey Kladov
c4b0d3cd56
make parent module cancelable
2018-10-20 21:52:49 +03:00
Aleksey Kladov
61518580ed
introduce cancelable
2018-10-20 21:46:17 +03:00
Alan Du
0857c22f26
Revert "clippy: Fix new_ret_no_self"
...
This reverts commit 2ae9dfa812
.
2018-10-20 12:29:25 -04:00
Aleksey Kladov
73dd870da2
update salsa
2018-10-20 18:43:02 +03:00
bors[bot]
2ded93a78a
Merge #143
...
143: Implement Find All References and Rename for local variables r=matklad a=kjeremy
Expose `find_all_refs` in `Analysis`. This currently only works for local variables.
Use this in the LSP to implement find all references and rename.
Co-authored-by: Jeremy A. Kolb <jkolb@ara.com>
2018-10-20 12:51:30 +00:00
Jeremy A. Kolb
9f9e41885c
LSP: Add support for prepareRename
2018-10-19 15:25:10 -04:00
Jeremy A. Kolb
2844c8fdfa
Handle renaming of local variables
2018-10-18 17:56:22 -04:00
Jeremy A. Kolb
3746689e9d
Implement Find All References for local variables
2018-10-18 13:40:12 -04:00
Alan Du
6dd3fa6a94
clippy: cast_lossless
2018-10-17 19:42:23 -04:00
Alan Du
a5da770ec6
Fix function calls
2018-10-17 19:42:23 -04:00
Alan Du
fc8024de51
clippy: type_complexity
2018-10-17 19:42:23 -04:00
Alan Du
bc774fe6cf
clippy: needless_lifetimes
2018-10-17 19:42:23 -04:00
Alan Du
2ae9dfa812
clippy: Fix new_ret_no_self
2018-10-17 19:42:23 -04:00
Alan Du
2268a2f8c6
Silence clippy::derive_hash_xor_eq
...
Manually implement PartialEq
2018-10-17 19:42:23 -04:00
Alan Du
4e8ea94e2b
Remove Copy trait on LeafAtOffset
...
Because it's a stateful iterator, it's easier to explicitly clone it
when necesary.
Fixes clippy:clone_on_copy
2018-10-17 19:42:23 -04:00
Alan Du
d493a4476c
clippy: Use if lets and remove redundant returns
2018-10-17 19:42:23 -04:00
Alan Du
5db663d61f
Clippy lint: single-character string constant
2018-10-17 19:42:23 -04:00
Aleksey Kladov
00cdde2c52
Update rowan
2018-10-17 19:52:25 +03:00
Aleksey Kladov
2f4a248f80
rename gen-kinds to gen-syntax
2018-10-16 21:17:19 +03:00
Aleksey Kladov
b43bcd43c6
fix tests
2018-10-16 20:53:19 +03:00
Aleksey Kladov
0b6d4983de
Switch to published teraron
2018-10-16 20:36:45 +03:00
Aleksey Kladov
514aa3cf85
extract teraron
2018-10-16 20:31:30 +03:00
Jeremy A. Kolb
61f3a438d3
Cargo Format
...
Run `cargo fmt` and ignore generated files
2018-10-16 09:41:10 -04:00
bors[bot]
39cb6c6d3f
Merge #128
...
128: Add a test to verify if the generated codes are up-to-date. r=matklad a=mominul
This test checks if the generated codes are up-to-date every time during `cargo test`.
I have confirmed that the test works by manually editing the `grammar.ron` file.
Closes #126
Thanks!
Co-authored-by: Muhammad Mominul Huque <mominul2082@gmail.com>
2018-10-16 12:24:26 +00:00
Muhammad Mominul Huque
2c4cfb297e
take &Path
instead of PathBuf
2018-10-16 15:36:53 +06:00
Aleksey Kladov
f30a7deff1
switch to salsa release
2018-10-15 23:57:46 +03:00
Aleksey Kladov
fc31ddd303
Simplify
2018-10-15 22:59:18 +03:00
Aleksey Kladov
85ff328d31
remove clones
2018-10-15 22:36:08 +03:00
Aleksey Kladov
bbcd998433
make analysis sync
2018-10-15 22:29:24 +03:00
Aleksey Kladov
76c51fae77
Tweak writable root API
2018-10-15 22:05:21 +03:00
Aleksey Kladov
8c88900fa9
remove resolver from world
2018-10-15 22:01:50 +03:00
Aleksey Kladov
ee69fddf02
Drop dead code
2018-10-15 21:56:01 +03:00
Muhammad Mominul Huque
9d9e637ef3
Refactor the constants
2018-10-16 00:54:27 +06:00
Aleksey Kladov
7503c5528f
fix tests
2018-10-15 21:54:12 +03:00
Aleksey Kladov
062019590d
Switch to the master of salsa
2018-10-15 21:25:54 +03:00
Aleksey Kladov
d783371b86
migrate modue map to salsa
2018-10-15 21:20:20 +03:00
Aleksey Kladov
d8aee31a60
start salsa migration
2018-10-15 21:19:49 +03:00
Aleksey Kladov
93d77e9b22
remove our own copy of salsa
...
salsa-rs/salsa is faster and more type safe
2018-10-15 21:12:19 +03:00
Aleksey Kladov
64b879d6a9
add salsa dep, break the world
2018-10-15 21:12:06 +03:00
Aleksey Kladov
9a98d8e99a
regenerate
2018-10-15 20:54:07 +03:00
Aleksey Kladov
376639c70f
Parse crate paths in expressions
2018-10-15 20:52:56 +03:00
Muhammad Mominul Huque
ce73df065f
Use CARGO_MANIFEST_DIR for locating the grammar.ron file
2018-10-15 23:52:11 +06:00
Aleksey Kladov
bb298158eb
migrate analysis and server to 2018
2018-10-15 20:15:53 +03:00
Aleksey Kladov
2dd6858d03
switch ra_cli to 2018
2018-10-15 20:06:02 +03:00
Aleksey Kladov
1624bf2d7f
switch editor to 2018
2018-10-15 20:05:26 +03:00
Aleksey Kladov
9434920648
switch base crates to 2018
2018-10-15 20:00:54 +03:00
Aleksey Kladov
171c176833
Run cargo fix
2018-10-15 19:55:32 +03:00
bors[bot]
a230b438e0
Merge #127
...
127: Improve folding r=matklad a=aochagavia
I was messing around with adding support for multiline comments in folding and ended up changing a bunch of other things.
First of all, I am not convinced of folding groups of successive items. For instance, I don't see why it is worthwhile to be able to fold something like the following:
```rust
use foo;
use bar;
```
Furthermore, this causes problems if you want to fold a multiline import:
```rust
use foo::{
quux
};
use bar;
```
The problem is that now there are two possible folds at the same position: we could fold the first use or we could fold the import group. IMO, the only place where folding groups makes sense is when folding comments. Therefore I have **removed folding import groups in favor of folding multiline imports**.
Regarding folding comments, I made it a bit more robust by requiring that comments can only be folded if they have the same flavor. So if you have a bunch of `//` comments followed by `//!` comments, you will get two separate fold groups instead of a single one.
Finally, I rewrote the API in such a way that it should be trivial to add new folds. You only need to:
* Create a new FoldKind
* Add it to the `fold_kind` function that converts from `SyntaxKind` to `FoldKind`
Fixes #113
Co-authored-by: Adolfo Ochagavía <github@adolfo.ochagavia.xyz>
2018-10-15 16:48:17 +00:00
Muhammad Mominul Huque
33b378797c
Show how to generate code with error message
2018-10-14 20:58:53 +06:00
Muhammad Mominul Huque
114e9a2d74
create cli.rs and make the tests passing
2018-10-14 20:32:57 +06:00
Adolfo Ochagavía
2bc9e9f327
Improve tests
2018-10-13 21:33:15 +02:00
Adolfo Ochagavía
c5069eeef5
Only fold groups of similar comments
2018-10-13 15:37:44 +02:00
Adolfo Ochagavía
4b3737510b
Cleanup fold code and split logic to fold single elements
2018-10-12 19:20:58 +02:00
Jeremy A. Kolb
c9909f42ba
A FnDescriptor shouldn't exist without a name
2018-10-12 07:54:57 -04:00
Jeremy A. Kolb
3ac5199755
Regenerate
2018-10-12 07:43:37 -04:00
Adolfo Ochagavía
ee0a6bf053
Fold multiline comments
2018-10-12 08:59:12 +02:00
Jeremy A. Kolb
f8a2b53304
Language Server: textDocument/signatureHelp
...
Implements a pretty barebones function signature help mechanism in
the language server.
Users can use `Analysis::resolve_callback()` to get basic information
about a call site.
Fixes #102
2018-10-11 16:40:46 -04:00
bors[bot]
2ba6f18586
Merge #122
...
122: Use rustc-hash crate r=matklad a=mominul
Replace std's HashMap, HashSet with FxHashMap and FxHashSet.
Closes #121
Thanks!
Co-authored-by: Muhammad Mominul Huque <mominul2082@gmail.com>
2018-10-11 18:28:44 +00:00
Muhammad Mominul Huque
dc2b30e9b6
Replace HashMap, HashSet with FxHashMap and FxHashSet
2018-10-12 00:07:44 +06:00
bors[bot]
77e9bf9b5f
Merge #116
...
116: Collapse comments upon join r=matklad a=aochagavia
Todo:
- [x] Write tests
- [x] Resolve fixmes
- [x] Implement `comment_start_length` using the parser
I left a bunch of questions as fixmes. Can someone take a look at them? Also, I would love to use the parser to calculate the length of the leading characters in a comment (`//`, `///`, `//!`, `/*`), so any hints are greatly appreciated.
Co-authored-by: Adolfo Ochagavía <aochagavia92@gmail.com>
Co-authored-by: Adolfo Ochagavía <github@adolfo.ochagavia.xyz>
2018-10-11 15:43:34 +00:00
Adolfo Ochagavía
6fe77db413
Remove smart multiline comment join
2018-10-11 17:16:12 +02:00
Adolfo Ochagavía
92f5ca64ae
Add tests
2018-10-11 17:11:59 +02:00
Adolfo Ochagavía
5508c91b3e
Remove nesting
2018-10-11 16:45:52 +02:00
Adolfo Ochagavía
f88e13f539
Use Comment wrapper
2018-10-11 16:25:35 +02:00
bors[bot]
9b155c8976
Merge #118
...
118: Remove error publishing through publishDecorations r=matklad a=aochagavia
The errors are already reported by `publishDiagnostics`
Closes #109
Co-authored-by: Adolfo Ochagavía <aochagavia92@gmail.com>
2018-10-11 09:18:33 +00:00
Reinier Maas
6abecf76e5
Update crates/ra_syntax/src/ast/generated.rs
...
effect of running cargo gen-kinds
2018-10-10 17:26:01 +02:00
Reinier Maas
c579b47b4a
Update generated.rs.tera
...
Removing `-` for #114
2018-10-10 17:18:21 +02:00
Adolfo Ochagavía
edd162bda8
Report errors only once
2018-10-10 16:59:46 +02:00
Adolfo Ochagavía
26d34cc443
Remove error publishing through publishDecorations
2018-10-10 16:49:32 +02:00
Adolfo Ochagavía
27a86cb7df
Collapse comments upon join
2018-10-10 12:37:06 +02:00
bors[bot]
31c8ebb743
Merge #106
...
106: Add on-enter handler r=matklad a=matklad
Now, typing doc comments is much more pleasant
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2018-10-09 16:52:48 +00:00
Aleksey Kladov
2b956fd3a8
Add on-enter handler
...
Now, typing doc comments is much more pleasant
2018-10-09 19:52:06 +03:00
Aleksey Kladov
5d1dae83a1
Switch to absolute offsets for extend comment word
2018-10-09 18:53:35 +03:00
Aleksey Kladov
239213a3db
Prepare gen_lsp_server for publishing
2018-10-09 12:55:23 +03:00
Aleksey Kladov
a05e09e9c5
Attach comments smartly
2018-10-08 17:36:38 +03:00
Aleksey Kladov
b642e6c645
replace loop with iterators
2018-10-08 15:46:14 +03:00
Aleksey Kladov
86a7ac2d31
Simplify event processing
2018-10-08 15:44:00 +03:00
Aleksey Kladov
3c12d38a32
tfn snippet
2018-10-08 14:08:31 +03:00
bors[bot]
e4fdfd1501
Merge #98
...
98: WIP: Add resolve_local_name to resolve names in a function scope r=kjeremy a=kjeremy
First step to resolving #80
Co-authored-by: Jeremy A. Kolb <jkolb@ara.com>
2018-10-07 17:01:57 +00:00
Jeremy A. Kolb
ff1b2da502
Remove functional noop
2018-10-06 13:41:33 -04:00
Jeremy A. Kolb
828bd73195
Resolve local names first
2018-10-06 12:02:15 -04:00
Jeremy A. Kolb
1d4c767879
WIP: This doesn't currently work but I also don't think it's the right abstraction
2018-10-05 15:21:40 -04:00
Jeremy A. Kolb
91312a9ff9
Add resolve_local_name to resolve names in a function scope
2018-10-05 10:53:17 -04:00
Daniel McNab
80eefcbc05
Add cargo gen-kinds
documentation
2018-10-04 21:43:58 +01:00
bors[bot]
81bf190f7a
Merge #94
...
94: Extend comments by single word first r=matklad a=kjeremy
Fixes #88
Co-authored-by: Jeremy A. Kolb <jkolb@ara.com>
2018-10-04 14:25:53 +00:00
Jeremy A. Kolb
a30039ba62
Pull casts out of TextUnit
2018-10-04 09:39:02 -04:00
Jeremy A. Kolb
334d266b77
Simplify extend_single_word_in_comment
2018-10-04 09:35:55 -04:00
bors[bot]
7a025ad201
Merge #93
...
93: Support leading pipe in match arms r=matklad a=DJMcNab
This adds support for match arms of the form:
```rust
<...>
| X | Y => <...>,
| X => <...>,
| 1..2 => <...>,
etc
```
# Implementation discussion
This just naïvely 'eats' a leading pipe if one is available. The equivalent line in the reference `libsyntax` is in [`parse_arm`](441519536c/src/libsyntax/parse/parser.rs (L3552)
).
As noted in the comment linked above, this feature was formally introduced as a result of rust-lang/rfcs#1925 . This feature is in active use in the [`rust-analyzer` codebase](c87fcb4ea5/crates/ra_syntax/src/syntax_kinds/generated.rs (L231)
)
I have added some tests for this feature, but maybe more would be required
EDIT: Always looking for feedback - is this PR description over-engineered?
Co-authored-by: Daniel McNab <36049421+djmcnab@users.noreply.github.com>
2018-10-04 07:02:19 +00:00
Jeremy A. Kolb
4c2be06a7e
Extend comments by single word first
...
Fixes #88
2018-10-03 17:04:00 -04:00
Daniel McNab
a55ef9b3ed
Support leading pipe in match arms
2018-10-03 21:47:03 +01:00
Aleksey Kladov
1a2a8dec14
Make siblings an inherent method
2018-10-02 18:14:33 +03:00
Aleksey Kladov
d323c81d5c
make ancestors and descendants inherent
2018-10-02 18:02:57 +03:00
Aleksey Kladov
dccaa5e45e
use aliases
2018-10-02 17:50:56 +03:00
Aleksey Kladov
a261a1836b
Move to rowan for syntax tree impl
2018-10-02 17:09:23 +03:00
Aleksey Kladov
804e29402a
fix code actions
2018-09-29 21:59:34 +03:00
Aleksey Kladov
baaf027da0
support 2018 paths
2018-09-29 14:53:23 +03:00
bors[bot]
5e1d109cbb
Merge #81
...
81: [WIP] Reject impl keyword inside impl header r=matklad a=csmoe
Closes #77
Co-authored-by: csmoe <35686186+csmoe@users.noreply.github.com>
2018-09-26 20:14:28 +00:00
csmoe
8b710e9535
generate testsuite for impl_type
2018-09-26 16:53:16 +08:00
csmoe
edf1cc3582
parse impl type
2018-09-25 22:21:16 +08:00
Jeremy A. Kolb
4d52d004d5
Unit Tests
2018-09-24 10:48:13 -04:00
Jeremy A. Kolb
ff0a706a30
Split folding ranges into editor and lsp parts
2018-09-24 09:52:33 -04:00
csmoe
cacb32d88a
reject impl keyword in impl header
2018-09-24 11:44:43 +08:00
csmoe
e446316585
add test for impl recovery
2018-09-24 11:44:43 +08:00
Jeremy A. Kolb
bd2b2f1b48
Implement folding ranges
2018-09-23 11:19:36 -04:00
Jeremy A. Kolb
e293a16d6b
Support LSP 3.13
2018-09-23 11:10:57 -04:00
bors[bot]
f5808b21a4
Merge #75
...
75: libsyntax2 -> rust-analyzer r=matklad a=kjeremy
Change a few `libsyntax2` to `rust-analyzer`
Co-authored-by: Jeremy A. Kolb <jkolb@ara.com>
2018-09-19 10:56:31 +00:00
Aleksey Kladov
4d5cfd7229
prefer lifetimes in extend selection
2018-09-19 13:55:47 +03:00
Aleksey Kladov
d6c7030aeb
Add emacs function for extend shirnk selection
2018-09-19 00:46:10 +03:00
Jeremy A. Kolb
8845b50438
libsyntax2 -> rust-analyzer
2018-09-18 17:40:33 -04:00
Aleksey Kladov
79293d2593
eprintln
2018-09-16 17:24:18 +03:00
Aleksey Kladov
b5021411a8
rename all things
2018-09-16 13:07:39 +03:00
Aleksey Kladov
ba0bfeee12
fix derecated call
2018-09-16 03:06:56 +03:00
Aleksey Kladov
5b70e5cf0c
fix installation for windows
2018-09-16 00:02:25 +01:00
Aleksey Kladov
722706fe41
get rid of commandspeck
2018-09-16 02:12:53 +03:00
bors[bot]
3993bb4de9
Merge #67
...
67: Salsa r=matklad a=matklad
The aim of this PR is to transition from rather ad-hock FileData and ModuleMap caching strategy to something resembling a general-purpose red-green engine.
Ideally, we shouldn't recompute ModuleMap at all, unless the set of mod decls or files changes.
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2018-09-15 21:11:25 +00:00
Aleksey Kladov
fcdf3a52b4
everysalsa
2018-09-16 00:00:05 +03:00
Aleksey Kladov
e69ff21207
kill old module_map
2018-09-16 00:00:05 +03:00
Aleksey Kladov
3ebeb0db8d
move readonly source to module tree descr
2018-09-16 00:00:05 +03:00
Aleksey Kladov
58674dc3c4
ModuleTreeDescriptor
2018-09-16 00:00:05 +03:00
Aleksey Kladov
d59413c895
yet another db api
2018-09-16 00:00:05 +03:00
Aleksey Kladov
0d7b1e442d
minor
2018-09-16 00:00:05 +03:00
Aleksey Kladov
47be3a3a24
renames
2018-09-16 00:00:05 +03:00
Aleksey Kladov
8c737255ff
use salsa for new module map
2018-09-16 00:00:05 +03:00
Aleksey Kladov
60fdfec327
eager invalidation
2018-09-16 00:00:05 +03:00
Aleksey Kladov
cecc7ad5b2
be generic over data
2018-09-16 00:00:05 +03:00
Aleksey Kladov
8cf9c27196
generic salsa algo
2018-09-16 00:00:05 +03:00
Aleksey Kladov
0e493160c0
store params in the graph
2018-09-16 00:00:05 +03:00
Aleksey Kladov
907d44a751
any-cache
2018-09-16 00:00:05 +03:00
Aleksey Kladov
dbdf72e2e2
fix dep tracking
2018-09-16 00:00:05 +03:00
Aleksey Kladov
c81d0d51bf
add deps tracking
2018-09-16 00:00:05 +03:00
Aleksey Kladov
db14b4270c
Add simplisitc global modification caching
2018-09-16 00:00:05 +03:00
Aleksey Kladov
3ae3b3eb06
initial query tracing
2018-09-16 00:00:05 +03:00
Aleksey Kladov
99d02fe583
start query-based modules
2018-09-16 00:00:05 +03:00
bors[bot]
2a56b5c4f0
Merge #69
...
69: Incremental reparsing for single tokens r=matklad a=darksv
Implement incremental reparsing for `WHITESPACE`, `COMMENT`, `DOC_COMMENT`, `IDENT`, `STRING` and `RAW_STRING`. This allows to avoid reparsing whole blocks when a change was made only within these tokens.
Co-authored-by: darksv <darek969-12@o2.pl>
2018-09-15 20:57:06 +00:00
darksv
ab00639032
independent tests for incremental reparsing of blocks and leaves
2018-09-15 17:05:08 +02:00
darksv
46cee0415c
move reparsing tests
2018-09-15 14:35:30 +02:00
darksv
16ad5384f0
commit missing file
2018-09-15 13:42:10 +02:00
darksv
a29211918b
create separated mod for reparsing functionality
2018-09-15 13:35:55 +02:00
darksv
d825cffe3b
adjust trailing newline
2018-09-14 23:45:19 +02:00
darksv
ecbfe68bf4
add missing files with inline tests
2018-09-14 23:33:29 +02:00
darksv
100968b689
Support for unions
2018-09-14 22:51:12 +02:00
darksv
bc94bf95ce
correctly handle IDENTs when changed to contextual keywords
2018-09-14 19:26:48 +02:00
darksv
c300135322
create leaf directly without calling the parser
2018-09-14 19:23:10 +02:00
darksv
4356240fa4
Incremental reparsing for single tokens (WHITESPACE, COMMENT, DOC_COMMENT, IDENT, STRING, RAW_STRING)
2018-09-13 23:25:05 +02:00
Aleksey Kladov
b6f8037a6f
don't get stuck in slice patterns
2018-09-12 11:26:52 +03:00
Aleksey Kladov
ccc75675b6
correctly setup path-map for fs-changes
2018-09-12 11:19:19 +03:00
bors[bot]
e240360ee2
Merge #68
...
68: Implement incremental reparsing for remaining braced blocks r=matklad a=darksv
Fixes #66
Co-authored-by: darksv <darek969-12@o2.pl>
2018-09-11 07:32:36 +00:00
darksv
d0cfeb4f16
Do not reparse token tree when it is not delimited by braces
2018-09-10 23:21:16 +02:00
darksv
64d07c1bd4
Implement reparsing for remaining blocks
2018-09-10 20:14:09 +02:00
Aleksey Kladov
505895a25f
store file rsovler
2018-09-10 12:57:40 +03:00
bors[bot]
4f64709666
Merge #65
...
65: simplify r=matklad a=matklad
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2018-09-08 16:24:24 +00:00
Aleksey Kladov
f19a82beac
simplify
2018-09-08 19:16:11 +03:00
Aleksey Kladov
a5c333c3ed
Fix yet another parser infinite loop
...
This commit is an example of fixing a common parser error: infinite
loop due to error recovery.
This error typically happens when we parse a list of items and fail to
parse a specific item at the current position.
One choices is to skip a token and try to parse a list item at the
next position. This is a good, but not universal, default. When
parsing a list of arguments in a function call, you, for example,
don't want to skip over `fn`, because it's most likely that it is a
function declaration, and not a mistyped arg:
```
fn foo() {
quux(1, 2
fn bar() {
}
```
Another choice is to bail out of the loop immediately, but it isn't
perfect either: sometimes skipping over garbage helps:
```
quux(1, foo:, 92) // should skip over `:`, b/c that's part of `foo::bar`
```
In general, parser tries to balance these two cases, though we don't
have a definitive strategy yet.
However, if the parser accidentally neither skips over a token, nor
breaks out of the loop, then it becomes stuck in the loop infinitely
(there's an internal counter to self-check this situation and panic
though), and that's exactly what is demonstrated by the test.
To fix such situation, first of all, add the test case to tests/data/parser/{err,fuzz-failures}.
Then, run
```
RUST_BACKTRACE=short cargo test --package libsyntax2
````
to verify that parser indeed panics, and to get an idea what grammar
production is the culprit (look for `_list` functions!).
In this case, I see
```
10: libsyntax2::grammar::expressions::atom::match_arm_list
at crates/libsyntax2/src/grammar/expressions/atom.rs:309
```
and that's look like it might be a culprit. I verify it by adding
`eprintln!("loopy {:?}", p.current());` and indeed I see that this is
printed repeatedly.
Diagnosing this a bit shows that the problem is that
`pattern::pattern` function does not consume anything if the next
token is `let`. That is a good default to make cases like
```
let
let foo = 92;
```
where the user hasn't typed the pattern yet, to parse in a reasonable
they correctly.
For match arms, pretty much the single thing we expect is a pattern,
so, for a fix, I introduce a special variant of pattern that does not
do recovery.
2018-09-08 19:10:40 +03:00
Aleksey Kladov
3ab9f4ad7f
Add fuzz failures dir
2018-09-08 18:42:59 +03:00
Aleksey Kladov
ba4a697d8c
move fuzz-invariants to the library
2018-09-08 18:34:41 +03:00
Pascal Hertleif
a37cd5ad43
Add trivial fuzzer for parser
...
As described in #61 , fuzz testing some parts of this would be ~~fun~~
helpful. So, I started with the most trivial fuzzer I could think of:
Put random stuff into File::parse and see what happens.
To speed things up, I also did
cp src/**/*.rs fuzz/corpus/parser/
in the `crates/libsyntax2/` directory (running the fuzzer once will
generate the necessary directories).
2018-09-08 16:55:53 +02:00
Aleksey Kladov
df05c5c3e2
Don't overflow when limiting symbol search
2018-09-08 15:39:28 +03:00
Aleksey Kladov
7daaddb2ac
Some abstraction around workers
2018-09-08 13:15:01 +03:00
Aleksey Kladov
326ffcefe0
Deal with deadlocks in a more principaled way
2018-09-08 12:36:02 +03:00
Aleksey Kladov
d9ccebd913
fix deadlock
2018-09-08 12:08:46 +03:00
Aleksey Kladov
f48b9d9be7
Fix block structure in enums
2018-09-08 10:55:09 +03:00
Aleksey Kladov
749907d330
simplify
2018-09-08 10:38:53 +03:00
Aleksey Kladov
febbc9acdd
Don't get stuck in tuple exprs
2018-09-08 10:35:05 +03:00
Aleksey Kladov
a0a347eac9
Don't get stuck in macros
2018-09-08 10:28:53 +03:00
Aleksey Kladov
bd3a26493f
fix stuck parser
2018-09-08 10:13:32 +03:00
Aleksey Kladov
44334f6f56
fix labled expressions
2018-09-08 09:18:42 +03:00
Aleksey Kladov
127814d9a7
nested mod completion
2018-09-08 01:35:20 +03:00
Aleksey Kladov
ff1c82216c
Remove dyn dispatch
2018-09-08 01:16:07 +03:00
Aleksey Kladov
fcfda94664
Separete API from IMPL
...
Looks like there's a rule of thumb: don't call API functions from an
implementation! In this case, following this rule of thumb saves us an
Arc-bump!
2018-09-07 22:05:05 +03:00
Zac Winter
518cc87496
Moved TokenSet into it's own file.
2018-09-06 21:57:04 +08:00
Aleksey Kladov
751562d2f7
better introduce
2018-09-06 01:19:24 +03:00
Aleksey Kladov
bb64edf8ba
introduce variable
2018-09-06 00:59:07 +03:00
Aleksey Kladov
47e8b80e9b
use correct workdir for the server
2018-09-05 21:38:43 +03:00
Aleksey Kladov
669eabe892
even less hacks
2018-09-05 20:22:52 +03:00
Aleksey Kladov
d0e22d7578
less hacky paths
2018-09-05 18:27:44 +03:00
bors[bot]
ad451686a8
Merge #56
...
56: Unify lookahead naming between parser and lexer. r=matklad a=zachlute
Resolves Issue #26 .
I wanted to play around with libsyntax2, and fixing a random issue seemed like a good way to mess around in the code.
This PR mostly does what's suggested in that issue. I elected to go with `at` and `at_str` instead of trying to do any fancy overloading shenanigans, because...uh, well, frankly I don't really know how to do any fancy overloading shenanigans. The only really questionable bit is `nth_is_p`, which could also have potentially been named `nth_at_p`, but `is` seemed more apropos.
I also added simple tests for `Ptr` so I could be less terrified I broke something.
Comments and criticisms very welcome. I'm still pretty new to Rust.
Co-authored-by: Zach Lute <zach.lute@gmail.com>
2018-09-05 15:07:17 +00:00
Aleksey Kladov
649f7faf7d
fix tests on windows
2018-09-05 15:03:27 +01:00
Zach Lute
d21fead150
Added tests for Ptr.
2018-09-04 23:26:11 -07:00
Zach Lute
af0ae9ee04
Updated Ptr methods to better match Parser method names.
2018-09-04 22:56:16 -07:00
Aleksey Kladov
f87771092c
switch to rayon threadpool
2018-09-04 20:43:37 +03:00
Aleksey Kladov
8b0210d233
simplify
2018-09-04 19:00:01 +03:00
Aleksey Kladov
8ed06d766f
better extend selection
2018-09-04 12:48:39 +03:00
Aleksey Kladov
e44a6bcc82
for types in bounds
2018-09-04 12:25:23 +03:00
Aleksey Kladov
3a017aaa52
dont change readonly files
2018-09-04 11:40:45 +03:00
Aleksey Kladov
a668f703fa
micro-optimize
2018-09-04 05:09:39 +03:00
Aleksey Kladov
294534abc7
accidentally quadratic
2018-09-04 05:04:55 +03:00
Aleksey Kladov
4df965a002
work
2018-09-04 04:13:22 +03:00
Aleksey Kladov
c3e28f0646
extern blocks
2018-09-04 00:49:21 +03:00
Aleksey Kladov
952da31f44
switch to internal feedback
2018-09-03 23:32:42 +03:00
Aleksey Kladov
971054e4d0
fix the test
2018-09-03 21:51:17 +03:00
Aleksey Kladov
f590635f57
faster text len
2018-09-03 21:48:26 +03:00
Aleksey Kladov
5ba645c009
index libraies off the main thread
2018-09-03 21:26:59 +03:00
Aleksey Kladov
47cbaeba6f
Index deps
2018-09-03 21:03:37 +03:00
Aleksey Kladov
b04c14d4ad
dispatch acros roots
2018-09-03 19:46:30 +03:00
Aleksey Kladov
2f2feef9af
completion for trait params
2018-09-03 15:46:14 +03:00
Aleksey Kladov
4798a89a12
Complete params
2018-09-03 15:10:06 +03:00
Aleksey Kladov
58480b9190
method call scope
2018-09-03 02:01:43 +03:00
Aleksey Kladov
fdd282ee0c
improve test
2018-09-03 01:52:59 +03:00
Aleksey Kladov
23303cd0f8
match scope
2018-09-03 01:51:46 +03:00
Aleksey Kladov
83e2ab434c
store file id inside symbol
2018-09-02 23:36:23 +03:00
Aleksey Kladov
a5e319ec7e
Store symbols separately from file data
2018-09-02 23:09:47 +03:00
Aleksey Kladov
440dc41dd8
Add source root
2018-09-02 22:51:59 +03:00
Aleksey Kladov
e98d8cd255
nail down runnables
2018-09-02 16:36:03 +03:00
Aleksey Kladov
1329dd4e28
Avoid clones
2018-09-02 15:18:43 +03:00
Aleksey Kladov
80be61ed78
project model
2018-09-02 14:46:15 +03:00
Aleksey Kladov
7fad13de73
store messages in tests
2018-09-02 12:34:06 +03:00
Aleksey Kladov
d752455637
introduce project model
2018-09-02 11:37:57 +03:00
Aleksey Kladov
541170420b
Add an integration test
2018-09-01 20:21:11 +03:00
Aleksey Kladov
e8515fecd7
split lib
2018-09-01 18:16:08 +03:00
Aleksey Kladov
4268fbeaa1
simplify
2018-09-01 18:03:57 +03:00
Aleksey Kladov
8f1ce82753
move to gen-server impl
2018-09-01 17:40:45 +03:00
Aleksey Kladov
3588d6b2da
add gen_lsp_server
2018-09-01 16:18:02 +03:00
Aleksey Kladov
f5669dfc56
No self-imports in completion
2018-09-01 12:46:43 +03:00
Aleksey Kladov
2161a1689d
Type aliases to scope
2018-09-01 12:30:53 +03:00
Aleksey Kladov
f2772e29ae
add crate graph
2018-08-31 19:14:08 +03:00
Aleksey Kladov
7a5bc94774
complete self
2018-08-31 16:30:42 +03:00
Aleksey Kladov
cdb9b4cbf4
handle shadowing
2018-08-31 15:53:52 +03:00
Aleksey Kladov
78d60a549d
default method name to type name
2018-08-31 15:10:37 +03:00
Aleksey Kladov
05a9d42f54
tweak extend selection
2018-08-31 14:52:29 +03:00
Aleksey Kladov
8fc7f438c4
start item recovery
2018-08-31 13:35:48 +03:00
Aleksey Kladov
faebae74e4
fix tests
2018-08-31 12:13:02 +03:00
Aleksey Kladov
d999f4b568
cancelation
2018-08-31 12:04:33 +03:00
Aleksey Kladov
efa6a952b4
cancelation tokens
2018-08-31 10:27:38 +03:00
Aleksey Kladov
902df0fc05
add test
2018-08-30 21:42:23 +03:00
Aleksey Kladov
8f552ab352
break/continue completion
2018-08-30 21:32:12 +03:00
Aleksey Kladov
80ab3433d3
complete imports
2018-08-30 20:37:33 +03:00
Aleksey Kladov
49e14a99ed
Complete types
2018-08-30 20:03:18 +03:00
Aleksey Kladov
9fcebbc512
subscriptions
2018-08-30 16:27:09 +03:00
Aleksey Kladov
7570d85869
loop scope
2018-08-30 16:05:49 +03:00
Aleksey Kladov
c2c64145cb
move
2018-08-30 13:12:49 +03:00
Aleksey Kladov
1f2fb4e27f
move
2018-08-30 12:52:21 +03:00
Aleksey Kladov
0d6d74e78e
minor
2018-08-30 12:34:31 +03:00
Aleksey Kladov
7d95d38ecb
fix join lines selection
2018-08-29 18:35:28 +03:00
Aleksey Kladov
09ea0ca7e5
rename world -> analysis impl
2018-08-29 18:23:57 +03:00
Aleksey Kladov
0f968ee430
minor
2018-08-29 18:12:28 +03:00
Aleksey Kladov
4dd4571bfe
minor
2018-08-29 18:09:08 +03:00
Aleksey Kladov
1baba9a2e2
Minor
2018-08-29 18:07:56 +03:00
Aleksey Kladov
2e2c2e62eb
Remove dead code
2018-08-29 18:06:46 +03:00
Aleksey Kladov
fce6bc0acc
Make world private
2018-08-29 18:05:54 +03:00
Aleksey Kladov
8abf536343
Grand refactoring
2018-08-29 18:03:14 +03:00
Aleksey Kladov
754c034a81
fix tests
2018-08-29 11:15:51 +03:00
Aleksey Kladov
15f15d92eb
add impl works with lifetimes
2018-08-28 23:59:57 +03:00
Aleksey Kladov
ba02a55330
simplify
2018-08-28 22:58:02 +03:00
Aleksey Kladov
69eeae0c99
polish join
2018-08-28 22:52:51 +03:00
Aleksey Kladov
6effddb18c
fix comma list
2018-08-28 21:48:14 +03:00
Aleksey Kladov
e6ab53619b
be more careful with adding semis
2018-08-28 21:45:59 +03:00
Aleksey Kladov
f5de8212da
Tweak return completion
2018-08-28 21:31:34 +03:00
Aleksey Kladov
d351ae67a9
Smart return completion
2018-08-28 21:14:13 +03:00
Aleksey Kladov
2257c08cb1
Add ret type
2018-08-28 21:11:17 +03:00
Aleksey Kladov
b00a4d43ec
Dont diagnose inline mods
2018-08-28 20:29:36 +03:00
Aleksey Kladov
4c1f17af7d
completion snippets
2018-08-28 20:26:57 +03:00
Aleksey Kladov
b6c654e233
reread files from disk
2018-08-28 19:42:55 +03:00
Aleksey Kladov
dea6ed73fa
better pattern recovery
2018-08-28 19:35:09 +03:00
Aleksey Kladov
537ea620bb
complete items from module scope
2018-08-28 19:23:55 +03:00
Aleksey Kladov
d34588bf83
create module smartly
2018-08-28 18:22:59 +03:00
Aleksey Kladov
748a4cacd2
Reorganize tests
2018-08-28 14:47:12 +03:00
Aleksey Kladov
6c41a205a9
join any block
2018-08-28 14:21:37 +03:00
Aleksey Kladov
288c9d1ac6
Simplify API
2018-08-28 14:07:41 +03:00
Aleksey Kladov
7e74af3226
Avoid materializing strings
2018-08-28 14:06:30 +03:00
Aleksey Kladov
363f466627
tone down on eq typed
2018-08-28 11:17:08 +03:00
Aleksey Kladov
2fa90e736b
better recovery for exprs
2018-08-28 11:12:42 +03:00
Aleksey Kladov
13110f48e9
Log errors
2018-08-28 00:42:13 +03:00
Aleksey Kladov
8f5330cb07
More robust highlighting
2018-08-28 00:20:59 +03:00
Aleksey Kladov
422efe59af
you better run
2018-08-27 22:52:43 +03:00
Aleksey Kladov
5751815314
Add runnables
2018-08-27 22:03:19 +03:00
Aleksey Kladov
b79c8b6d8a
Fix error blocks
2018-08-27 21:10:02 +03:00
Aleksey Kladov
7f4b07a907
Refactor
2018-08-27 21:02:47 +03:00
Aleksey Kladov
aaca7d003b
move scopes to file
2018-08-27 20:58:38 +03:00
Aleksey Kladov
07cbb7d73d
Support if-let in scopes
2018-08-27 12:22:09 +03:00
Aleksey Kladov
c16530c988
visitor-less scopes
2018-08-27 10:12:28 +03:00
Aleksey Kladov
8b0298ce09
scopes
2018-08-27 10:01:31 +03:00
Aleksey Kladov
9b69c7df19
fix curly braces parsing
2018-08-26 19:04:44 +03:00
Aleksey Kladov
71722c047f
Simple scope completion
2018-08-26 12:51:45 +03:00
Aleksey Kladov
ac226021cf
scope based comletion
2018-08-26 12:09:28 +03:00
Aleksey Kladov
4c121bfa2f
extend selection to comments
2018-08-26 10:43:03 +03:00
Aleksey Kladov
a450142aca
fix stray curly
2018-08-26 09:12:18 +03:00
Aleksey Kladov
a48964c64d
switch to upstream fst
2018-08-25 23:50:16 +03:00
Aleksey Kladov
367e523442
Require semi after exprs
2018-08-25 16:04:47 +03:00
Aleksey Kladov
a80c07bdff
Avoid massacaring errors
2018-08-25 15:12:17 +03:00
Aleksey Kladov
c3e5987c43
incremental reparse
2018-08-25 14:45:17 +03:00
Aleksey Kladov
5211e7d977
move
2018-08-25 14:30:54 +03:00
Aleksey Kladov
2d41bc3e6c
rename
2018-08-25 14:26:34 +03:00
Aleksey Kladov
da329c2e53
more incremental work
2018-08-25 13:57:13 +03:00
Aleksey Kladov
19d933ba38
join lines works for lambdas
2018-08-25 13:42:40 +03:00
Aleksey Kladov
838820ad98
fix assertione error on block parsing
2018-08-25 13:21:43 +03:00
Aleksey Kladov
fed5727ea2
start incremental reparse
2018-08-25 13:17:54 +03:00
Aleksey Kladov
32c8ea9307
Move atom edit to libsyntax2
2018-08-25 12:44:26 +03:00
Aleksey Kladov
87cd57d56a
Refactor
2018-08-25 12:10:35 +03:00
Aleksey Kladov
a44428fc79
kill more reexports
2018-08-25 11:48:59 +03:00
Aleksey Kladov
70333c8edf
remove reesports
2018-08-25 11:47:24 +03:00
Aleksey Kladov
220d285b4a
rename ParsedFile -> File
2018-08-25 11:44:58 +03:00
Aleksey Kladov
cf278ed3bf
rename file -> root
2018-08-25 11:44:17 +03:00
Aleksey Kladov
9fae494a8d
Move ParsedFile to top
2018-08-25 11:40:17 +03:00
Aleksey Kladov
f104458d45
parameter parsing does not destroy blocks
2018-08-24 20:50:37 +03:00
Aleksey Kladov
b0aac1ca98
rename tests
2018-08-24 19:35:20 +03:00
Aleksey Kladov
7edab6ae6b
nodes for blocks
2018-08-24 19:27:30 +03:00
Aleksey Kladov
6cade3f6d8
Runnig tests somehow
2018-08-24 13:41:25 +03:00
Aleksey Kladov
89e56c364f
Labeled expressions
2018-08-24 11:45:50 +03:00
Aleksey Kladov
719710a132
break&continue
2018-08-24 11:21:13 +03:00
Aleksey Kladov
a66c94af1b
renames
2018-08-24 02:14:10 +03:00
Aleksey Kladov
dc40f1298a
better self-types
2018-08-24 01:19:38 +03:00
Aleksey Kladov
cf7d4a2a24
Simplify
2018-08-24 00:48:10 +03:00
Aleksey Kladov
dd64a155e9
rename
2018-08-24 00:16:29 +03:00
Aleksey Kladov
f47f58ffe5
better join-lines
2018-08-24 00:13:16 +03:00
Aleksey Kladov
8ad586a44e
JoinLines frontend
2018-08-23 22:14:51 +03:00
Aleksey Kladov
18918769ba
Smarter join lines
2018-08-23 21:38:25 +03:00
Aleksey Kladov
6dcf87fb5f
Start join-lines
2018-08-23 20:55:23 +03:00
Aleksey Kladov
ec70617564
byte literals
2018-08-23 20:04:13 +03:00
Aleksey Kladov
a077533513
Allow arbitrary self-types
2018-08-23 19:07:33 +03:00
Aleksey Kladov
8d82d1551e
Extend add impl
2018-08-22 19:06:30 +03:00
Aleksey Kladov
147578f0fe
add impl initial
2018-08-22 18:05:43 +03:00
Aleksey Kladov
69a524fbef
dedupe
2018-08-22 17:01:51 +03:00
Aleksey Kladov
8e3bec11eb
TypeParamList Owner
2018-08-22 16:46:42 +03:00
Aleksey Kladov
55896aedb1
minor
2018-08-22 15:01:34 +03:00
Aleksey Kladov
a4f140b0f3
no escape
2018-08-22 13:22:06 +03:00
Aleksey Kladov
e8dfb92641
Simplify
2018-08-22 12:58:34 +03:00
Aleksey Kladov
641659d5a8
Smarter extend selection
2018-08-22 11:56:36 +03:00
Aleksey Kladov
9909875bfe
parent module request
2018-08-22 10:53:48 +03:00
Aleksey Kladov
ecc9df5f00
simpler update
2018-08-21 22:24:59 +03:00
Aleksey Kladov
b937262c9b
Module map implementation
2018-08-21 18:30:10 +03:00