summaryrefslogtreecommitdiff
path: root/mlir/utils
diff options
context:
space:
mode:
authorRiver Riddle <riddleriver@gmail.com>2022-04-06 11:42:19 -0700
committerRiver Riddle <riddleriver@gmail.com>2022-04-11 15:41:19 -0700
commite93ba84262a98595fa5b13bdc47d4ee02d6fcd36 (patch)
tree726361e7a50fb10882843603cacca410a63b5324 /mlir/utils
parent4a6f5d73a4d16e36baa9639642533b4eb700adf2 (diff)
downloadllvm-e93ba84262a98595fa5b13bdc47d4ee02d6fcd36.tar.gz
[mlir-vscode] Don't emit errors if the user didn't set the server path
This avoids emitting errors in situations where the user doesn't have a server setup, and doesn't mean to (e.g. when they merely want syntax highlighting). Differential Revision: https://reviews.llvm.org/D123240
Diffstat (limited to 'mlir/utils')
-rw-r--r--mlir/utils/vscode/package.json2
-rw-r--r--mlir/utils/vscode/src/extension.ts9
-rw-r--r--mlir/utils/vscode/src/mlirContext.ts20
3 files changed, 12 insertions, 19 deletions
diff --git a/mlir/utils/vscode/package.json b/mlir/utils/vscode/package.json
index 74072d9e1858..230124a6a629 100644
--- a/mlir/utils/vscode/package.json
+++ b/mlir/utils/vscode/package.json
@@ -2,7 +2,7 @@
"name": "vscode-mlir",
"displayName": "MLIR",
"description": "MLIR Language Extension",
- "version": "0.0.5",
+ "version": "0.0.6",
"publisher": "llvm-vs-code-extensions",
"homepage": "https://mlir.llvm.org/",
"icon": "icon.png",
diff --git a/mlir/utils/vscode/src/extension.ts b/mlir/utils/vscode/src/extension.ts
index 664146c84fba..7d2d4a7383eb 100644
--- a/mlir/utils/vscode/src/extension.ts
+++ b/mlir/utils/vscode/src/extension.ts
@@ -16,13 +16,10 @@ export function activate(context: vscode.ExtensionContext) {
// Initialize the commands of the extension.
context.subscriptions.push(
vscode.commands.registerCommand('mlir.restart', async () => {
- // Dispose and reactivate the context. This is essentially the same as
- // the start of the extension, but we don't re-emit warnings for
- // uninitialized settings.
+ // Dispose and reactivate the context.
mlirContext.dispose();
- await mlirContext.activate(outputChannel,
- /*warnOnEmptyServerPath=*/ false);
+ await mlirContext.activate(outputChannel);
}));
- mlirContext.activate(outputChannel, /*warnOnEmptyServerPath=*/ true);
+ mlirContext.activate(outputChannel);
}
diff --git a/mlir/utils/vscode/src/mlirContext.ts b/mlir/utils/vscode/src/mlirContext.ts
index 067856c0e007..3827fcc86d33 100644
--- a/mlir/utils/vscode/src/mlirContext.ts
+++ b/mlir/utils/vscode/src/mlirContext.ts
@@ -29,8 +29,7 @@ export class MLIRContext implements vscode.Disposable {
/**
* Activate the MLIR context, and start the language clients.
*/
- async activate(outputChannel: vscode.OutputChannel,
- warnOnEmptyServerPath: boolean) {
+ async activate(outputChannel: vscode.OutputChannel) {
// This lambda is used to lazily start language clients for the given
// document. It removes the need to pro-actively start language clients for
// every folder within the workspace and every language type we provide.
@@ -64,7 +63,7 @@ export class MLIRContext implements vscode.Disposable {
if (!folderContext.clients.has(document.languageId)) {
let client = await this.activateWorkspaceFolder(
workspaceFolder, serverSettingName, document.languageId,
- outputChannel, warnOnEmptyServerPath);
+ outputChannel);
folderContext.clients.set(document.languageId, client);
}
};
@@ -92,12 +91,10 @@ export class MLIRContext implements vscode.Disposable {
*/
async activateWorkspaceFolder(workspaceFolder: vscode.WorkspaceFolder,
serverSettingName: string, languageName: string,
- outputChannel: vscode.OutputChannel,
- warnOnEmptyServerPath: boolean):
+ outputChannel: vscode.OutputChannel):
Promise<vscodelc.LanguageClient> {
const [server, serverPath] = await this.startLanguageClient(
- workspaceFolder, outputChannel, warnOnEmptyServerPath,
- serverSettingName, languageName);
+ workspaceFolder, outputChannel, serverSettingName, languageName);
// Watch for configuration changes on this folder.
await configWatcher.activate(this, workspaceFolder, serverSettingName,
@@ -112,7 +109,6 @@ export class MLIRContext implements vscode.Disposable {
*/
async startLanguageClient(workspaceFolder: vscode.WorkspaceFolder,
outputChannel: vscode.OutputChannel,
- warnOnEmptyServerPath: boolean,
serverSettingName: string, languageName: string):
Promise<[ vscodelc.LanguageClient, string ]> {
const clientTitle = languageName.toUpperCase() + ' Language Client';
@@ -122,14 +118,14 @@ export class MLIRContext implements vscode.Disposable {
var serverPath =
await this.resolveServerPath(serverSettingName, workspaceFolder);
- // If we aren't emitting warnings on an empty server path, and the server
- // path is empty, bail.
- if (!warnOnEmptyServerPath && serverPath === '') {
+ // If the server path is empty, bail. We don't emit errors if the user
+ // hasn't explicitly configured the server.
+ if (serverPath === '') {
return [ null, serverPath ];
}
// Check that the file actually exists.
- if (serverPath === '' || !fs.existsSync(serverPath)) {
+ if (!fs.existsSync(serverPath)) {
vscode.window
.showErrorMessage(
`${clientTitle}: Unable to resolve path for '${