mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-26 04:53:34 +00:00
Merge #3203
3203: vscode: press ; to respect semicolons r=matklad a=Veetaha Co-authored-by: Veetaha <gerzoh1@gmail.com>
This commit is contained in:
commit
326556b090
7 changed files with 17 additions and 17 deletions
|
@ -16,7 +16,7 @@ export * from './ssr';
|
||||||
|
|
||||||
export function collectGarbage(ctx: Ctx): Cmd {
|
export function collectGarbage(ctx: Ctx): Cmd {
|
||||||
return async () => {
|
return async () => {
|
||||||
ctx.client?.sendRequest<null>('rust-analyzer/collectGarbage', null);
|
await ctx.client?.sendRequest<null>('rust-analyzer/collectGarbage', null);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,9 +14,9 @@ export function ssr(ctx: Ctx): Cmd {
|
||||||
if (x.includes('==>>')) {
|
if (x.includes('==>>')) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return "Enter request: pattern ==>> template"
|
return "Enter request: pattern ==>> template";
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
const request = await vscode.window.showInputBox(options);
|
const request = await vscode.window.showInputBox(options);
|
||||||
|
|
||||||
if (!request) return;
|
if (!request) return;
|
||||||
|
|
|
@ -29,7 +29,7 @@ export function activateHighlighting(ctx: Ctx) {
|
||||||
highlighter.setHighlights(targetEditor, params.decorations);
|
highlighter.setHighlights(targetEditor, params.decorations);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
};
|
}
|
||||||
|
|
||||||
vscode.workspace.onDidChangeConfiguration(
|
vscode.workspace.onDidChangeConfiguration(
|
||||||
_ => highlighter.removeHighlights(),
|
_ => highlighter.removeHighlights(),
|
||||||
|
|
|
@ -29,13 +29,13 @@ export function activateInlayHints(ctx: Ctx) {
|
||||||
|
|
||||||
ctx.pushCleanup({
|
ctx.pushCleanup({
|
||||||
dispose() {
|
dispose() {
|
||||||
hintsUpdater.clear()
|
hintsUpdater.clear();
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
|
|
||||||
// XXX: we don't await this, thus Promise rejections won't be handled, but
|
// XXX: we don't await this, thus Promise rejections won't be handled, but
|
||||||
// this should never throw in fact...
|
// this should never throw in fact...
|
||||||
hintsUpdater.setEnabled(ctx.config.displayInlayHints)
|
void hintsUpdater.setEnabled(ctx.config.displayInlayHints);
|
||||||
}
|
}
|
||||||
|
|
||||||
interface InlayHintsParams {
|
interface InlayHintsParams {
|
||||||
|
@ -57,7 +57,7 @@ const typeHintDecorationType = vscode.window.createTextEditorDecorationType({
|
||||||
const parameterHintDecorationType = vscode.window.createTextEditorDecorationType({
|
const parameterHintDecorationType = vscode.window.createTextEditorDecorationType({
|
||||||
before: {
|
before: {
|
||||||
color: new vscode.ThemeColor('rust_analyzer.inlayHint'),
|
color: new vscode.ThemeColor('rust_analyzer.inlayHint'),
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
class HintsUpdater {
|
class HintsUpdater {
|
||||||
|
|
|
@ -15,7 +15,7 @@ import { throttle } from "throttle-debounce";
|
||||||
* of the artifact as `displayName`.
|
* of the artifact as `displayName`.
|
||||||
*/
|
*/
|
||||||
export async function downloadArtifact(
|
export async function downloadArtifact(
|
||||||
{downloadUrl, releaseName}: ArtifactReleaseInfo,
|
{ downloadUrl, releaseName }: ArtifactReleaseInfo,
|
||||||
artifactFileName: string,
|
artifactFileName: string,
|
||||||
installationDir: string,
|
installationDir: string,
|
||||||
displayName: string,
|
displayName: string,
|
||||||
|
@ -23,7 +23,7 @@ export async function downloadArtifact(
|
||||||
await fs.mkdir(installationDir).catch(err => assert.strictEqual(
|
await fs.mkdir(installationDir).catch(err => assert.strictEqual(
|
||||||
err?.code,
|
err?.code,
|
||||||
"EEXIST",
|
"EEXIST",
|
||||||
`Couldn't create directory "${installationDir}" to download `+
|
`Couldn't create directory "${installationDir}" to download ` +
|
||||||
`${artifactFileName} artifact: ${err.message}`
|
`${artifactFileName} artifact: ${err.message}`
|
||||||
));
|
));
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@ import { Config } from './config';
|
||||||
let ctx: Ctx | undefined;
|
let ctx: Ctx | undefined;
|
||||||
|
|
||||||
export async function activate(context: vscode.ExtensionContext) {
|
export async function activate(context: vscode.ExtensionContext) {
|
||||||
const config = new Config(context)
|
const config = new Config(context);
|
||||||
|
|
||||||
const serverPath = await ensureServerBinary(config.serverSource);
|
const serverPath = await ensureServerBinary(config.serverSource);
|
||||||
if (serverPath == null) {
|
if (serverPath == null) {
|
||||||
|
@ -33,7 +33,7 @@ export async function activate(context: vscode.ExtensionContext) {
|
||||||
vscode.window.showInformationMessage('Reloading rust-analyzer...');
|
vscode.window.showInformationMessage('Reloading rust-analyzer...');
|
||||||
// @DanTup maneuver
|
// @DanTup maneuver
|
||||||
// https://github.com/microsoft/vscode/issues/45774#issuecomment-373423895
|
// https://github.com/microsoft/vscode/issues/45774#issuecomment-373423895
|
||||||
await deactivate()
|
await deactivate();
|
||||||
for (const sub of ctx.subscriptions) {
|
for (const sub of ctx.subscriptions) {
|
||||||
try {
|
try {
|
||||||
sub.dispose();
|
sub.dispose();
|
||||||
|
@ -41,9 +41,9 @@ export async function activate(context: vscode.ExtensionContext) {
|
||||||
console.error(e);
|
console.error(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
await activate(context)
|
await activate(context);
|
||||||
}
|
};
|
||||||
})
|
});
|
||||||
|
|
||||||
ctx.registerCommand('analyzerStatus', commands.analyzerStatus);
|
ctx.registerCommand('analyzerStatus', commands.analyzerStatus);
|
||||||
ctx.registerCommand('collectGarbage', commands.collectGarbage);
|
ctx.registerCommand('collectGarbage', commands.collectGarbage);
|
||||||
|
@ -54,7 +54,7 @@ export async function activate(context: vscode.ExtensionContext) {
|
||||||
ctx.registerCommand('expandMacro', commands.expandMacro);
|
ctx.registerCommand('expandMacro', commands.expandMacro);
|
||||||
ctx.registerCommand('run', commands.run);
|
ctx.registerCommand('run', commands.run);
|
||||||
ctx.registerCommand('onEnter', commands.onEnter);
|
ctx.registerCommand('onEnter', commands.onEnter);
|
||||||
ctx.registerCommand('ssr', commands.ssr)
|
ctx.registerCommand('ssr', commands.ssr);
|
||||||
|
|
||||||
// Internal commands which are invoked by the server.
|
// Internal commands which are invoked by the server.
|
||||||
ctx.registerCommand('runSingle', commands.runSingle);
|
ctx.registerCommand('runSingle', commands.runSingle);
|
||||||
|
|
|
@ -15,7 +15,7 @@ export function activateStatusDisplay(ctx: Ctx) {
|
||||||
WorkDoneProgress.type,
|
WorkDoneProgress.type,
|
||||||
'rustAnalyzer/cargoWatcher',
|
'rustAnalyzer/cargoWatcher',
|
||||||
params => statusDisplay.handleProgressNotification(params)
|
params => statusDisplay.handleProgressNotification(params)
|
||||||
))
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue