Skip to content

Commit 7f415b3

Browse files
committed
Fix rock dect
1 parent a7bb90d commit 7f415b3

File tree

3 files changed

+12
-7
lines changed

3 files changed

+12
-7
lines changed

src/extension.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,11 @@ async function initializeLuaRocks(): Promise<void> {
306306

307307
// Initialize LuaRocks manager
308308
luaRocksManager = new LuaRocksManager(workspaceFolder);
309+
let workspace = await luaRocksManager.detectLuaRocksWorkspace();
310+
if (!workspace.hasRockspec) {
311+
return;
312+
}
313+
309314
luaRocksTreeProvider = new LuaRocksTreeProvider(luaRocksManager);
310315

311316
// Register tree view
@@ -323,11 +328,7 @@ async function initializeLuaRocks(): Promise<void> {
323328
// Check if LuaRocks is installed
324329
const isInstalled = await luaRocksManager.checkLuaRocksInstallation();
325330
if (isInstalled) {
326-
// Auto-detect workspace type
327-
const workspace = await luaRocksManager.detectLuaRocksWorkspace();
328-
if (workspace.hasRockspec) {
329-
vscode.window.showInformationMessage(`Found ${workspace.rockspecFiles.length} rockspec file(s) in workspace`);
330-
}
331+
vscode.window.showInformationMessage(`Found ${workspace.rockspecFiles.length} rockspec file(s) in workspace`);
331332
}
332333
}
333334

src/languageConfiguration.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ export class LuaLanguageConfiguration implements LanguageConfiguration {
3636
undefined,
3737
workspace.workspaceFolders?.[0]
3838
);
39-
const autoInsertTripleDash = config.get<boolean>('emmylua.misc.autoInsertTripleDash', true);
39+
const completeAnnotation = config.get<boolean>('emmylua.language.completeAnnotation', true);
4040
// 第二个参数是默认值(当配置不存在时使用)
41-
if (autoInsertTripleDash) {
41+
if (completeAnnotation) {
4242
this.onEnterRules = [
4343
{
4444
action: { indentAction: IndentAction.None, appendText: "--- " },

src/luarocks/LuaRocksManager.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,10 @@ export class LuaRocksManager {
7777
);
7878

7979
workspace.hasRockspec = rockspecFiles.length > 0;
80+
if (!workspace.hasRockspec) {
81+
return workspace;
82+
}
83+
8084
workspace.rockspecFiles = rockspecFiles.map(uri => uri.fsPath);
8185

8286
// 检查 .luarocks 配置文件

0 commit comments

Comments
 (0)