Skip to content

Commit 159934a

Browse files
Issue warn if EmmyLua is old for global config
This patch makes the extension issue a warning if the EmmyLua dependency is old and doesn't support global configuration feature added in 0.9.19.
1 parent 048c996 commit 159934a

File tree

3 files changed

+26
-6
lines changed

3 files changed

+26
-6
lines changed

package-lock.json

Lines changed: 12 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,9 @@
8080
"title": "Tarantool",
8181
"properties": {
8282
"tarantool.ttPath": {
83-
"type": "string",
84-
"default": "tt",
85-
"markdownDescription": "Specifies a path to the TT executable, defaults to the one available in the `$PATH`."
83+
"type": "string",
84+
"default": "tt",
85+
"markdownDescription": "Specifies a path to the TT executable, defaults to the one available in the `$PATH`."
8686
}
8787
}
8888
}
@@ -104,6 +104,7 @@
104104
"@types/lodash": "^4.17.16",
105105
"@types/mocha": "^10.0.10",
106106
"@types/node": "20.x",
107+
"@types/semver": "^7.7.0",
107108
"@types/vscode": "^1.88.0",
108109
"@typescript-eslint/eslint-plugin": "^8.28.0",
109110
"@typescript-eslint/parser": "^8.28.0",
@@ -113,6 +114,7 @@
113114
"copy-webpack-plugin": "^13.0.0",
114115
"eslint": "^9.23.0",
115116
"lodash": "^4.17.21",
117+
"semver": "^7.7.2",
116118
"ts-loader": "^9.5.2",
117119
"typescript": "^5.8.2",
118120
"webpack": "^5.98.0",

src/extension.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import * as vscode from 'vscode';
22
import * as tt from './tt';
33
import * as fs from 'fs';
44
import * as _ from 'lodash';
5+
import * as semver from 'semver';
56
import * as utils from './utils';
67

78
const annotationsPaths = [
@@ -19,8 +20,16 @@ const emmyrc = {
1920
const emmyrcFile = '.emmyrc.json';
2021
const globalEmmyrcKey = 'emmylua.misc.globalConfigPath';
2122
const globalEmmyrcPath = __dirname + `/${emmyrcFile}`;
23+
const globalConfigEmmyluaVersion = '0.9.19';
2224

2325
async function initGlobalEmmyrc() {
26+
const emmyLua = vscode.extensions.getExtension('tangzx.emmylua');
27+
const emmyLuaVersion = emmyLua?.packageJSON.version;
28+
if (!semver.gte(emmyLuaVersion, globalConfigEmmyluaVersion)) {
29+
vscode.window.showWarningMessage(`Unable to set up Tarantool extension globally due to the old version of the EmmyLua extension: current version is ${emmyLuaVersion}, required version is ${globalConfigEmmyluaVersion}. Consider updating EmmyLua using marketplace or run a 'Tarantool: Initialize VS Code extension...' command having your Tarantool project opened`);
30+
return;
31+
}
32+
2433
const config = vscode.workspace.getConfiguration(undefined, null);
2534
const configuredGlobalEmmyrcPath = config.get(globalEmmyrcKey);
2635

0 commit comments

Comments
 (0)