mirror of
https://github.com/rust-lang/rust.git
synced 2025-05-14 02:49:40 +00:00
Add rust-analyzer.gotoLocation
command
This commit is contained in:
parent
d4e75312ba
commit
7e986d1504
8
.vscode/launch.json
vendored
8
.vscode/launch.json
vendored
@ -120,12 +120,6 @@
|
|||||||
"sourceMaps": true,
|
"sourceMaps": true,
|
||||||
"outFiles": [ "${workspaceFolder}/editors/code/out/tests/unit/**/*.js" ],
|
"outFiles": [ "${workspaceFolder}/editors/code/out/tests/unit/**/*.js" ],
|
||||||
"preLaunchTask": "Pretest"
|
"preLaunchTask": "Pretest"
|
||||||
},
|
}
|
||||||
{
|
|
||||||
"name": "(Windows) Attach",
|
|
||||||
"type": "cppvsdbg",
|
|
||||||
"request": "attach",
|
|
||||||
"processId": "${command:pickProcess}"
|
|
||||||
}
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,7 @@ members = [ "crates/*", "xtask/" ]
|
|||||||
[profile.dev]
|
[profile.dev]
|
||||||
# disabling debug info speeds up builds a bunch,
|
# disabling debug info speeds up builds a bunch,
|
||||||
# and we don't rely on it for debugging that much.
|
# and we don't rely on it for debugging that much.
|
||||||
debug = 2
|
debug = 0
|
||||||
|
|
||||||
[profile.release]
|
[profile.release]
|
||||||
incremental = true
|
incremental = true
|
||||||
|
@ -510,6 +510,11 @@
|
|||||||
"type": "boolean",
|
"type": "boolean",
|
||||||
"default": true
|
"default": true
|
||||||
},
|
},
|
||||||
|
"rust-analyzer.hoverActions.gotoTypeDef": {
|
||||||
|
"markdownDescription": "Whether to show `Go to Type Definition` action. Only applies when `#rust-analyzer.hoverActions.enable#` is set.",
|
||||||
|
"type": "boolean",
|
||||||
|
"default": true
|
||||||
|
},
|
||||||
"rust-analyzer.linkedProjects": {
|
"rust-analyzer.linkedProjects": {
|
||||||
"markdownDescription": "Disable project auto-discovery in favor of explicitly specified set of projects. \nElements must be paths pointing to Cargo.toml, rust-project.json, or JSON objects in rust-project.json format",
|
"markdownDescription": "Disable project auto-discovery in favor of explicitly specified set of projects. \nElements must be paths pointing to Cargo.toml, rust-project.json, or JSON objects in rust-project.json format",
|
||||||
"type": "array",
|
"type": "array",
|
||||||
|
@ -353,6 +353,20 @@ export function applyActionGroup(_ctx: Ctx): Cmd {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function gotoLocation(ctx: Ctx): Cmd {
|
||||||
|
return async (locationLink: lc.LocationLink) => {
|
||||||
|
const client = ctx.client;
|
||||||
|
if (client) {
|
||||||
|
const uri = client.protocol2CodeConverter.asUri(locationLink.targetUri);
|
||||||
|
let range = client.protocol2CodeConverter.asRange(locationLink.targetSelectionRange);
|
||||||
|
// collapse the range to a cursor position
|
||||||
|
range = range.with({ end: range.start });
|
||||||
|
|
||||||
|
await vscode.window.showTextDocument(uri, { selection: range });
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
export function resolveCodeAction(ctx: Ctx): Cmd {
|
export function resolveCodeAction(ctx: Ctx): Cmd {
|
||||||
const client = ctx.client;
|
const client = ctx.client;
|
||||||
return async (params: ra.ResolveCodeActionParams) => {
|
return async (params: ra.ResolveCodeActionParams) => {
|
||||||
|
@ -135,6 +135,9 @@ export class Config {
|
|||||||
return {
|
return {
|
||||||
enable: this.get<boolean>("hoverActions.enable"),
|
enable: this.get<boolean>("hoverActions.enable"),
|
||||||
implementations: this.get<boolean>("hoverActions.implementations"),
|
implementations: this.get<boolean>("hoverActions.implementations"),
|
||||||
|
run: this.get<boolean>("hoverActions.run"),
|
||||||
|
debug: this.get<boolean>("hoverActions.debug"),
|
||||||
|
gotoTypeDef: this.get<boolean>("hoverActions.gotoTypeDef"),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -100,6 +100,7 @@ export async function activate(context: vscode.ExtensionContext) {
|
|||||||
ctx.registerCommand('applySnippetWorkspaceEdit', commands.applySnippetWorkspaceEditCommand);
|
ctx.registerCommand('applySnippetWorkspaceEdit', commands.applySnippetWorkspaceEditCommand);
|
||||||
ctx.registerCommand('resolveCodeAction', commands.resolveCodeAction);
|
ctx.registerCommand('resolveCodeAction', commands.resolveCodeAction);
|
||||||
ctx.registerCommand('applyActionGroup', commands.applyActionGroup);
|
ctx.registerCommand('applyActionGroup', commands.applyActionGroup);
|
||||||
|
ctx.registerCommand('gotoLocation', commands.gotoLocation);
|
||||||
|
|
||||||
ctx.pushCleanup(activateTaskProvider(workspaceFolder));
|
ctx.pushCleanup(activateTaskProvider(workspaceFolder));
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user