diff options
author | bors[bot] <bors[bot]@users.noreply.github.com> | 2019-01-25 07:13:16 +0000 |
---|---|---|
committer | bors[bot] <bors[bot]@users.noreply.github.com> | 2019-01-25 07:13:16 +0000 |
commit | 675943712ce92e0ce04e85e6952f50bcbf1ee611 (patch) | |
tree | 20e611b63e26157457855db38d4fd866e6d3e7cd /crates/ra_syntax/src | |
parent | 1d4b421aad0bbcd26d88e65b28dbbb4efb51d155 (diff) | |
parent | 4eff8ddb8b8352d432d87198d43c674696ca9344 (diff) |
Merge #630
630: Fill in DocumentSymbol::detail r=matklad a=hban
Closes: #516
I just pulled type text from the syntax node and "formatted" is bit. VS Code can't really handle multi-line symbol detail (it's will crop it when rendering), so that formatting will just collapse all white-space to singe space. It isn't pretty, but maybe there's a better way.
Issue also mentions "need to be done for `NavigationTarget` to `SymbolInformation`", but `SymbolInformation` doesn't have detail field on it?
Co-authored-by: Hrvoje Ban <[email protected]>
Diffstat (limited to 'crates/ra_syntax/src')
-rw-r--r-- | crates/ra_syntax/src/ast/generated.rs | 18 | ||||
-rw-r--r-- | crates/ra_syntax/src/grammar.ron | 51 |
2 files changed, 45 insertions, 24 deletions
diff --git a/crates/ra_syntax/src/ast/generated.rs b/crates/ra_syntax/src/ast/generated.rs index bb223e0dc..7da19d782 100644 --- a/crates/ra_syntax/src/ast/generated.rs +++ b/crates/ra_syntax/src/ast/generated.rs | |||
@@ -598,7 +598,11 @@ impl ast::NameOwner for ConstDef {} | |||
598 | impl ast::TypeParamsOwner for ConstDef {} | 598 | impl ast::TypeParamsOwner for ConstDef {} |
599 | impl ast::AttrsOwner for ConstDef {} | 599 | impl ast::AttrsOwner for ConstDef {} |
600 | impl ast::DocCommentsOwner for ConstDef {} | 600 | impl ast::DocCommentsOwner for ConstDef {} |
601 | impl ConstDef {} | 601 | impl ConstDef { |
602 | pub fn type_ref(&self) -> Option<&TypeRef> { | ||
603 | super::child_opt(self) | ||
604 | } | ||
605 | } | ||
602 | 606 | ||
603 | // ContinueExpr | 607 | // ContinueExpr |
604 | #[derive(Debug, PartialEq, Eq, Hash)] | 608 | #[derive(Debug, PartialEq, Eq, Hash)] |
@@ -3407,7 +3411,11 @@ impl ast::NameOwner for StaticDef {} | |||
3407 | impl ast::TypeParamsOwner for StaticDef {} | 3411 | impl ast::TypeParamsOwner for StaticDef {} |
3408 | impl ast::AttrsOwner for StaticDef {} | 3412 | impl ast::AttrsOwner for StaticDef {} |
3409 | impl ast::DocCommentsOwner for StaticDef {} | 3413 | impl ast::DocCommentsOwner for StaticDef {} |
3410 | impl StaticDef {} | 3414 | impl StaticDef { |
3415 | pub fn type_ref(&self) -> Option<&TypeRef> { | ||
3416 | super::child_opt(self) | ||
3417 | } | ||
3418 | } | ||
3411 | 3419 | ||
3412 | // Stmt | 3420 | // Stmt |
3413 | #[derive(Debug, PartialEq, Eq, Hash)] | 3421 | #[derive(Debug, PartialEq, Eq, Hash)] |
@@ -3948,7 +3956,11 @@ impl ast::NameOwner for TypeDef {} | |||
3948 | impl ast::TypeParamsOwner for TypeDef {} | 3956 | impl ast::TypeParamsOwner for TypeDef {} |
3949 | impl ast::AttrsOwner for TypeDef {} | 3957 | impl ast::AttrsOwner for TypeDef {} |
3950 | impl ast::DocCommentsOwner for TypeDef {} | 3958 | impl ast::DocCommentsOwner for TypeDef {} |
3951 | impl TypeDef {} | 3959 | impl TypeDef { |
3960 | pub fn type_ref(&self) -> Option<&TypeRef> { | ||
3961 | super::child_opt(self) | ||
3962 | } | ||
3963 | } | ||
3952 | 3964 | ||
3953 | // TypeParam | 3965 | // TypeParam |
3954 | #[derive(Debug, PartialEq, Eq, Hash)] | 3966 | #[derive(Debug, PartialEq, Eq, Hash)] |
diff --git a/crates/ra_syntax/src/grammar.ron b/crates/ra_syntax/src/grammar.ron index dedefea59..cb5d6cde8 100644 --- a/crates/ra_syntax/src/grammar.ron +++ b/crates/ra_syntax/src/grammar.ron | |||
@@ -289,27 +289,36 @@ Grammar( | |||
289 | collections: [["impl_items", "ImplItem"]], | 289 | collections: [["impl_items", "ImplItem"]], |
290 | traits: [ "FnDefOwner", "ModuleItemOwner" ], | 290 | traits: [ "FnDefOwner", "ModuleItemOwner" ], |
291 | ), | 291 | ), |
292 | "ConstDef": ( traits: [ | 292 | "ConstDef": ( |
293 | "VisibilityOwner", | 293 | traits: [ |
294 | "NameOwner", | 294 | "VisibilityOwner", |
295 | "TypeParamsOwner", | 295 | "NameOwner", |
296 | "AttrsOwner", | 296 | "TypeParamsOwner", |
297 | "DocCommentsOwner" | 297 | "AttrsOwner", |
298 | ] ), | 298 | "DocCommentsOwner" |
299 | "StaticDef": ( traits: [ | 299 | ], |
300 | "VisibilityOwner", | 300 | options: ["TypeRef"] |
301 | "NameOwner", | 301 | ), |
302 | "TypeParamsOwner", | 302 | "StaticDef": ( |
303 | "AttrsOwner", | 303 | traits: [ |
304 | "DocCommentsOwner" | 304 | "VisibilityOwner", |
305 | ] ), | 305 | "NameOwner", |
306 | "TypeDef": ( traits: [ | 306 | "TypeParamsOwner", |
307 | "VisibilityOwner", | 307 | "AttrsOwner", |
308 | "NameOwner", | 308 | "DocCommentsOwner" |
309 | "TypeParamsOwner", | 309 | ], |
310 | "AttrsOwner", | 310 | options: ["TypeRef"] |
311 | "DocCommentsOwner" | 311 | ), |
312 | ] ), | 312 | "TypeDef": ( |
313 | traits: [ | ||
314 | "VisibilityOwner", | ||
315 | "NameOwner", | ||
316 | "TypeParamsOwner", | ||
317 | "AttrsOwner", | ||
318 | "DocCommentsOwner" | ||
319 | ], | ||
320 | options: ["TypeRef"] | ||
321 | ), | ||
313 | "ImplBlock": (options: ["ItemList"]), | 322 | "ImplBlock": (options: ["ItemList"]), |
314 | 323 | ||
315 | "ParenType": (options: ["TypeRef"]), | 324 | "ParenType": (options: ["TypeRef"]), |