@tsslint/typescript-plugin 1.0.12 → 1.0.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +21 -1
- package/package.json +4 -4
package/index.js
CHANGED
|
@@ -21,7 +21,7 @@ const init = modules => {
|
|
|
21
21
|
return pluginModule;
|
|
22
22
|
};
|
|
23
23
|
function decorateLanguageService(ts, tsconfig, info) {
|
|
24
|
-
const { getSemanticDiagnostics, getCodeFixesAtPosition, getCombinedCodeFix, } = info.languageService;
|
|
24
|
+
const { getSemanticDiagnostics, getCodeFixesAtPosition, getCombinedCodeFix, getApplicableRefactors, getEditsForRefactor, } = info.languageService;
|
|
25
25
|
const projectFileNameKeys = new Set();
|
|
26
26
|
let configFile;
|
|
27
27
|
let configFileBuildContext;
|
|
@@ -86,6 +86,26 @@ function decorateLanguageService(ts, tsconfig, info) {
|
|
|
86
86
|
}
|
|
87
87
|
return getCombinedCodeFix(scope, fixId, formatOptions, preferences);
|
|
88
88
|
};
|
|
89
|
+
info.languageService.getApplicableRefactors = (fileName, positionOrRange, preferences, triggerReason, kind, includeInteractiveActions) => {
|
|
90
|
+
const start = typeof positionOrRange === 'number' ? positionOrRange : positionOrRange.pos;
|
|
91
|
+
const end = typeof positionOrRange === 'number' ? positionOrRange : positionOrRange.end;
|
|
92
|
+
const refactors = linter?.getRefactors(fileName, start, end) ?? [];
|
|
93
|
+
return [
|
|
94
|
+
...getApplicableRefactors(fileName, positionOrRange, preferences, triggerReason, kind, includeInteractiveActions),
|
|
95
|
+
{
|
|
96
|
+
actions: refactors,
|
|
97
|
+
name: 'TSSLint',
|
|
98
|
+
description: 'TSSLint refactor actions',
|
|
99
|
+
},
|
|
100
|
+
];
|
|
101
|
+
};
|
|
102
|
+
info.languageService.getEditsForRefactor = (fileName, formatOptions, positionOrRange, refactorName, actionName, preferences, interactiveRefactorArguments) => {
|
|
103
|
+
const tsslintEdits = linter?.getRefactorEdits(fileName, actionName);
|
|
104
|
+
if (tsslintEdits) {
|
|
105
|
+
return { edits: tsslintEdits };
|
|
106
|
+
}
|
|
107
|
+
return getEditsForRefactor(fileName, formatOptions, positionOrRange, refactorName, actionName, preferences, interactiveRefactorArguments);
|
|
108
|
+
};
|
|
89
109
|
return { update };
|
|
90
110
|
function isProjectFileName(fileName) {
|
|
91
111
|
fileName = fileName.replace(/\\/g, '/');
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tsslint/typescript-plugin",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.14",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"files": [
|
|
6
6
|
"**/*.js",
|
|
@@ -12,10 +12,10 @@
|
|
|
12
12
|
"directory": "packages/typescript-plugin"
|
|
13
13
|
},
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"@tsslint/core": "1.0.
|
|
15
|
+
"@tsslint/core": "1.0.14"
|
|
16
16
|
},
|
|
17
17
|
"devDependencies": {
|
|
18
|
-
"@tsslint/config": "1.0.
|
|
18
|
+
"@tsslint/config": "1.0.14"
|
|
19
19
|
},
|
|
20
|
-
"gitHead": "
|
|
20
|
+
"gitHead": "84ea99432b44827a79ac034896202652bf21c912"
|
|
21
21
|
}
|