Skip to content

Commit 441d666

Browse files
committed
Code Navigation for stereotype nodes
1 parent 96c0d1d commit 441d666

File tree

2 files changed

+9
-12
lines changed
  • headless-services/spring-boot-language-server/src/main/java/org/springframework/ide/vscode/boot/java/commands
  • vscode-extensions/vscode-spring-boot/lib/explorer

2 files changed

+9
-12
lines changed

headless-services/spring-boot-language-server/src/main/java/org/springframework/ide/vscode/boot/java/commands/ToolsJsonNodeHandler.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
*/
4242
public class ToolsJsonNodeHandler implements NodeHandler<StereotypePackageElement, StereotypePackageElement, StereotypeClassElement, StereotypeMethodElement, Object> {
4343

44+
private static final String LOCATION = "location";
4445
public static final String ICON = "icon";
4546
public static final String TEXT = "text";
4647

@@ -82,7 +83,7 @@ public void handleStereotype(Stereotype stereotype, NodeContext context) {
8283
public void handleType(StereotypeClassElement type, NodeContext context) {
8384
addChild(node -> node
8485
.withAttribute(TEXT, labels.getTypeLabel(type))
85-
.withAttribute("location", type.getLocation())
86+
.withAttribute(LOCATION, type.getLocation())
8687
);
8788
}
8889

vscode-extensions/vscode-spring-boot/lib/explorer/nodes.ts

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -233,17 +233,13 @@ export class StereotypedNode extends SpringNode {
233233
if (this.n.attributes.location) {
234234
const location = this.n.attributes.location as Location;
235235
// Hard-coded range. Not present... likely not serialized correctly.
236-
const range = {
237-
start: {line: 0, character: 0},
238-
end: {line: 0, character: 0}
239-
}
240-
// item.command = {
241-
// command: "vscode.open",
242-
// title: "Navigate",
243-
// arguments: [location.uri, {
244-
// selection: /*location.range*/range
245-
// } as TextDocumentShowOptions]
246-
// };
236+
item.command = {
237+
command: "vscode.open",
238+
title: "Navigate",
239+
arguments: [location.uri, {
240+
selection: location.range
241+
} as TextDocumentShowOptions]
242+
};
247243
}
248244
return item;
249245
}

0 commit comments

Comments
 (0)