Commit Graph

956 Commits

Author SHA1 Message Date
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
Adolfo Ochagavía
3b42ddae60 Introduce SyntaxErrorKind and TextRange in SyntaxError 2018-11-04 21:16:38 +01:00
bors[bot]
576b9a0727 Merge #184
184: Basic validation for character literals r=aochagavia a=aochagavia

As part of #27 I would like to add a validator for characters that detects missing quotes and too long characters. I set up a dummy implementation to get my feet wet, which generates errors whenever it finds a character.

Right now I have the following questions:

1. The `SyntaxError` type seems too basic to me. I think it would make sense to have a `SyntaxErrorKind` instead of a `msg` field (we can implement `Display` for it so you can generate the string if desired). It should also have a `TextRange` instead of a `TextUnit`, so you can support errors that are longer than one character. Do you agree?
1. I am manually checking whether the literal is a character (see the `is_char` method). Ideally, I would like to have a `LiteralKind` enum with variants like `Int`, `Float`, `Char`, `String`, etc. but it seems cumbersome to write all that by hand. Is there a way to specify this in `grammar.ron` so that the code is generated (the same way the `Expr` enum is generated)?

By the way, there seems to be no error reporting of panics inside the language server. When I was developing this PR I accidentally introduced a panic, which resulted in no syntax errors being shown. I knew something was wrong, because normally the vscode highlights syntax errors, but I didn't know it was caused by a panic.

Co-authored-by: Adolfo Ochagavía <aochagavia92@gmail.com>
2018-11-04 14:47:20 +00:00
Adolfo Ochagavía
9b5bbab104 Add character literal parsing and validation 2018-11-04 15:17:24 +01:00
bors[bot]
19c6cbd954 Merge #187
187: Use Default everywhere r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2018-11-04 11:09:57 +00: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
bors[bot]
92c10bf1cc Merge #183
183: update salsa r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2018-11-01 12:30:52 +00: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
bors[bot]
f6f9a0bf35 Merge #182
182: Module source r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2018-11-01 10:53:17 +00: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
bors[bot]
41adf1bc4f Merge #178
178: Prevent panic by initializing LibrariesQuery r=matklad a=kjeremy



Co-authored-by: Jeremy A. Kolb <jkolb@ara.com>
2018-10-31 19:13:01 +00: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
bors[bot]
46cce4f8f1 Merge #169
169: Syntax ptr r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2018-10-30 18:32:24 +00:00
Aleksey Kladov
1643d94a65 switch to TextRange::subrange 2018-10-30 21:26:55 +03:00