navigate to POM of modules (#949)
Signed-off-by: Yan Zhang <yanzh@microsoft.com>
This commit is contained in:
Родитель
5283a0a53f
Коммит
4a5f7f760f
|
@ -16,6 +16,20 @@
|
|||
],
|
||||
"preLaunchTask": "npm: watch"
|
||||
},
|
||||
{
|
||||
"name": "Extension<Multi-Module>",
|
||||
"type": "extensionHost",
|
||||
"request": "launch",
|
||||
"runtimeExecutable": "${execPath}",
|
||||
"args": [
|
||||
"${workspaceFolder}/test/projects/multi-module",
|
||||
"--extensionDevelopmentPath=${workspaceFolder}",
|
||||
],
|
||||
"outFiles": [
|
||||
"${workspaceFolder}/dist/**/*.js"
|
||||
],
|
||||
"preLaunchTask": "npm: watch"
|
||||
},
|
||||
{
|
||||
"name": "Extension Tests - Maven Project",
|
||||
"type": "extensionHost",
|
||||
|
@ -41,4 +55,4 @@
|
|||
"port": 1044
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
|
@ -25,8 +25,8 @@ class DefinitionProvider implements vscode.DefinitionProvider {
|
|||
case XmlTagName.Version: {
|
||||
const targetNode = tagNode.parent;
|
||||
const selectionRange: vscode.Range = new vscode.Range(
|
||||
targetNode && targetNode.startIndex !== null ?document.positionAt(targetNode?.startIndex) : position,
|
||||
targetNode && targetNode.endIndex !== null ?document.positionAt(targetNode?.endIndex) : position,
|
||||
targetNode && targetNode.startIndex !== null ? document.positionAt(targetNode?.startIndex) : position,
|
||||
targetNode && targetNode.endIndex !== null ? document.positionAt(targetNode?.endIndex) : position,
|
||||
);
|
||||
|
||||
const siblingNodes: Node[] = tagNode.parent?.children ?? [];
|
||||
|
@ -51,6 +51,20 @@ class DefinitionProvider implements vscode.DefinitionProvider {
|
|||
}
|
||||
}
|
||||
}
|
||||
case XmlTagName.Module: {
|
||||
const moduleName = getTextFromNode(tagNode.firstChild);
|
||||
const targetUri = vscode.Uri.joinPath(document.uri, "..", moduleName, "pom.xml");
|
||||
const selectionRange: vscode.Range = new vscode.Range(
|
||||
tagNode && tagNode.startIndex !== null ? document.positionAt(tagNode.startIndex) : position,
|
||||
tagNode && tagNode.endIndex !== null ? document.positionAt(tagNode.endIndex) : position,
|
||||
);
|
||||
const definitionLink: vscode.LocationLink = {
|
||||
targetRange: new vscode.Range(0, 0, 0, 0),
|
||||
targetUri,
|
||||
originSelectionRange: selectionRange
|
||||
};
|
||||
return [definitionLink];
|
||||
}
|
||||
default:
|
||||
return undefined;
|
||||
}
|
||||
|
|
|
@ -1,24 +0,0 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT license.
|
||||
|
||||
import { MavenProjectManager } from "../../project/MavenProjectManager";
|
||||
import { ITreeItem } from "./ITreeItem";
|
||||
import { MavenProject } from "./MavenProject";
|
||||
import { Menu } from "./Menu";
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
export class ModulesMenu extends Menu implements ITreeItem {
|
||||
constructor(projectNode: MavenProject) {
|
||||
super(projectNode);
|
||||
this.name = "Modules";
|
||||
}
|
||||
|
||||
public getChildren() : MavenProject[] {
|
||||
return this.project.modules.map(modulePomPath => {
|
||||
const found: MavenProject | undefined = MavenProjectManager.get(modulePomPath);
|
||||
return found ? found : new MavenProject(modulePomPath);
|
||||
});
|
||||
}
|
||||
}
|
|
@ -14,7 +14,8 @@ export enum XmlTagName {
|
|||
Plugins = "plugins",
|
||||
Project = "project",
|
||||
Dependency = "dependency",
|
||||
Properties = "properties"
|
||||
Properties = "properties",
|
||||
Module = "module"
|
||||
}
|
||||
|
||||
export function getNodesByTag(text: string, tag: string): Element[] {
|
||||
|
|
Загрузка…
Ссылка в новой задаче