[Mlir-commits] [mlir] [vscode] Use which to default path (PR #83681)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Sat Mar 2 08:05:38 PST 2024


https://github.com/Freed-Wu created https://github.com/llvm/llvm-project/pull/83681

None

>From 3a0e91757f369cbaae4e327e736878b44a515ceb Mon Sep 17 00:00:00 2001
From: Wu Zhenyu <wuzhenyu at ustc.edu>
Date: Sat, 2 Mar 2024 23:58:17 +0800
Subject: [PATCH] [vscode] Use which to default path

---
 mlir/utils/vscode/package.json       | 3 ++-
 mlir/utils/vscode/src/mlirContext.ts | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/mlir/utils/vscode/package.json b/mlir/utils/vscode/package.json
index bd550e2b6e61e2..cb4a25cdaecea3 100644
--- a/mlir/utils/vscode/package.json
+++ b/mlir/utils/vscode/package.json
@@ -48,7 +48,8 @@
     "@vscode/vsce": "^2.19.0",
     "clang-format": "^1.8.0",
     "typescript": "^4.6.4",
-    "vscode-test": "^1.3.0"
+    "vscode-test": "^1.3.0",
+    "which": "^4.0.0"
   },
   "repository": {
     "type": "git",
diff --git a/mlir/utils/vscode/src/mlirContext.ts b/mlir/utils/vscode/src/mlirContext.ts
index c7b6de6322d27f..0c8b575f36cde9 100644
--- a/mlir/utils/vscode/src/mlirContext.ts
+++ b/mlir/utils/vscode/src/mlirContext.ts
@@ -2,6 +2,7 @@ import * as fs from 'fs';
 import * as path from 'path';
 import * as vscode from 'vscode';
 import * as vscodelc from 'vscode-languageclient/node';
+import * as which from 'which';
 
 import * as config from './config';
 import * as configWatcher from './configWatcher';
@@ -334,7 +335,7 @@ export class MLIRContext implements vscode.Disposable {
       if (defaultPath === '') {
         return filePath;
       }
-      filePath = defaultPath;
+      return await which(defaultPath);
 
       // Fallthrough to try resolving the default path.
     }



More information about the Mlir-commits mailing list