aboutsummaryrefslogtreecommitdiff
path: root/crates/rust-analyzer/src/to_proto.rs
Commit message (Collapse)AuthorAgeFilesLines
...
* fix folding range kindAleksey Kladov2021-03-131-1/+2
|
* Merge #7799bors[bot]2021-03-131-3/+2
|\ | | | | | | | | | | | | | | | | | | | | | | | | 7799: Related tests r=matklad a=vsrs ![tests](https://user-images.githubusercontent.com/62505555/109397453-a9013680-7947-11eb-8b11-ac03079f7645.gif) This adds an ability to look for tests for the item under the cursor: function, constant, data type, etc The LSP part is bound to change. But the feature itself already works and I'm looking for a feedback :) Co-authored-by: vsrs <[email protected]>
| * Remove unnecessary file_id argumentvsrs2021-02-271-3/+2
| |
* | update relevance score u8 -> u32Josh Mcguigan2021-03-121-8/+8
| |
* | add completion relevance scoreJosh Mcguigan2021-03-121-12/+22
| |
* | Future proof completion scoresAleksey Kladov2021-03-091-2/+4
| |
* | Selecting `&mut foo` completion now actually inserts `&mut`Aleksey Kladov2021-03-091-15/+16
| |
* | Cleanup auto-ref in completionAleksey Kladov2021-03-091-4/+3
| |
* | Fix bad namesAleksey Kladov2021-03-091-26/+26
| | | | | | | | `res` should only be used for the result variable
* | Make group imports configurableasv2021-03-071-1/+5
| |
* | Merge #7335 #7691bors[bot]2021-03-021-1/+1
|\ \ | |/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 7335: added region folding r=matklad a=LucianoBestia Regions of code that you'd like to be folded can be wrapped with `// #region` and `// #endregion` line comments. This is called "Region Folding". It is originally available for many languages in VSCode. But Rust-analyzer has its own folding function and this is missing. With this Pull Request I am suggesting a simple solution. The regions are a special kind of comments, so I added a bit of code in the comment folding function. The regex to match are: `^\s*//\s*#?region\b` and `^\s*//\s*#?endregion\b`. The number of space characters is not important. There is an optional # character. The line can end with a name of the region. Example: ```rust // 1. some normal comment // region: test // 2. some normal comment calling_function(x,y); // endregion: test ``` I added a test for this new functionality in `folding_ranges.rs`. Please, take a look and comment. I found that these exact regexes are already present in the file `language-configuration.json`, but I don't find a way to read this configuration. So my regex is hardcoded in the code. 7691: Suggest name in extract variable r=matklad a=cpud36 Generate better default name in extract variable assist as was mentioned in issue #1587 # Currently supported (in order of declining precedence) 1. Expr is argument to a function; use corresponding parameter name 2. Expr is result of a function or method call; use this function/method's name 3. Use expr type name (if possible) 4. Fallback to `var_name` otherwise # Showcase ![generate_derive_variable_name_from_method](https://user-images.githubusercontent.com/4218373/108013304-72105400-701c-11eb-9f13-eec52e74d0cc.gif) ![generate_derive_variable_name_from_param](https://user-images.githubusercontent.com/4218373/108013305-72a8ea80-701c-11eb-957e-2214f7f005de.gif) # Questions * Should we more aggressively strip known types? E.g. we already strip `&T -> T`; should we strip `Option<T> -> T`, `Result<T, E> -> T`, and others? * Integers and floats use `var_name` by default. Should we introduce a name, like `i`, `f` etc? * Can we return a list and suggest a name when renaming(like IntelliJ does)? * Should we add counters to remove duplicate variables? E.g. `type`, `type1`, type2`, etc. Co-authored-by: Luciano Bestia <[email protected]> Co-authored-by: Luciano <[email protected]> Co-authored-by: Vladyslav Katasonov <[email protected]>
| * rustfmt 1.4.30-stableLuciano Bestia2021-02-181-1/+2
| |
| * added region foldingLuciano Bestia2021-01-181-1/+1
| |
* | Merge #7657bors[bot]2021-02-161-43/+47
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 7657: utf8 r=matklad a=matklad - Prepare for utf-8 offsets - reduce code duplication in tests - Make utf8 default, implement utf16 in terms of it - Make it easy to add additional context for offset conversion - Implement utf8 offsets closes #7453 Co-authored-by: Aleksey Kladov <[email protected]>
| * | Fix bitrotted module nameAleksey Kladov2021-02-161-1/+1
| | |
| * | Implement utf8 offsetsAleksey Kladov2021-02-161-7/+18
| | |
| * | Make it easy to add additional context for offset conversionAleksey Kladov2021-02-161-43/+35
| | |
| * | Make utf8 default, implement utf16 in terms of itAleksey Kladov2021-02-161-0/+1
| | |
| * | Prepare for utf-8 offsetsAleksey Kladov2021-02-161-1/+1
| | |
* | | Fix a few clippy::perf warningskjeremy2021-02-161-2/+2
|/ /
* | Make it clear which client-side commands we useAleksey Kladov2021-02-141-35/+84
| |
* | Moved CodeLens to ide crateivan7702021-02-131-4/+141
| |
* | Pin Rust to 1.49.0 on CIJonas Schievink2021-02-121-1/+2
| |
* | Add a semantic token type for char literalspetr-tik2021-02-051-1/+2
| | | | | | | | | | The LSP spec doesn't recognise character literals, so had to extend the suported types to our own custom type
* | Partially unify SymbolKind and CompletionItemKindLukas Wirth2021-01-201-14/+22
| |
* | Move SymbolKind to ide_dbLukas Wirth2021-01-201-1/+2
| |
* | Add LifetimeParam and ConstParam to CompletionItemKindLukas Wirth2021-01-191-12/+14
| |
* | Add flyimport completion for trait assoc itemsKirill Bulatov2021-01-161-1/+1
|/
* Share import_assets and related entitiesKirill Bulatov2021-01-161-2/+3
|
* Phase out SourceFileEdits in favour of a plain HashMapLukas Wirth2021-01-141-1/+1
|
* Group file source edits by FileIdLukas Wirth2021-01-141-10/+9
|
* Don't show internal server error on renameAleksey Kladov2021-01-131-1/+6
| | | | | | | Doesn't quite work due to https://github.com/microsoft/vscode-languageserver-node/issues/730 Note that this intentionally removes `impl std::Error for RenameError` -- we nether want to blindly bubble the rename error.
* Split punctuation semantic highlighting up into more tagsLukas Wirth2021-01-101-4/+14
|
* Shorten namesAleksey Kladov2021-01-091-4/+4
|
* Shorten frequent namesAleksey Kladov2021-01-091-35/+30
|
* Rename dummy -> noneAleksey Kladov2021-01-091-1/+1
|
* Simplify highlighting infraAleksey Kladov2021-01-081-0/+3
| | | | This also fixes the killer whale bug
* Change <|> to $0 - RebaseKevaundray Wedderburn2021-01-071-1/+1
|
* Align config's API with usageAleksey Kladov2021-01-061-1/+9
| | | | The config now is mostly immutable, optimize for that.
* More maintainable configAleksey Kladov2021-01-061-3/+3
| | | | | | | Rather than eagerly converting JSON, we losslessly keep it as is, and change the shape of user-submitted data at the last moment. This also allows us to remove a bunch of wrong Defaults
* More maintainable caps configAleksey Kladov2021-01-051-3/+3
| | | | | The idea here is that we preserve client's config as is, without changes. This gets rid of state!
* Add ConstParams to the ide layerLukas Wirth2021-01-011-0/+2
|
* Simplify assists resolution APIAleksey Kladov2020-12-261-11/+8
| | | | | | Assist vs UnresolvedAssist split doesn't really pull its weight. This is especially bad if we want to include `Assist` as a field of diagnostics, where we'd have to make the thing generic.
* Support labels in reference searchLukas Wirth2020-12-241-1/+3
|
* Add initial_contents field for CreateFileDaiki Ihara2020-12-211-10/+27
|
* Clarify the meaning of no-op highlight tagAleksey Kladov2020-12-191-1/+1
|
* Use more Rustic highlighting specifiersAleksey Kladov2020-12-191-2/+8
| | | | | *Method* works for OO languages, but in rust we can also have associated constants & types, so let's move this to a modifier.
* Deduplicate highlight tags and symbol kindsAleksey Kladov2020-12-181-28/+31
| | | | | | | Curiously, LSP uses different enums for those, and unsurprising and annoyingly, there are things which exist in one but not in the other. Let's not repeat the mistake and unify the two things
* NavTarget doesn't assume that it points to a symbolAleksey Kladov2020-12-181-5/+4
|
* Don't expose SyntaxKind from IDE APIAleksey Kladov2020-12-181-17/+20
| | | | | | SyntaxKind is somewhat of an internal type, but IDE is using it to basically specify an icon. Let's have a dedicated entity for this instead.