Skip to content
This repository has been archived by the owner on Oct 12, 2022. It is now read-only.

Commit

Permalink
Fixing microsoft/vscode#49370 ts fixes and tslint fixes bite each other
Browse files Browse the repository at this point in the history
  • Loading branch information
egamma committed May 25, 2018
1 parent 183d710 commit 741f9dd
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 9 deletions.
20 changes: 17 additions & 3 deletions tslint-server/src/tslintServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -661,13 +661,19 @@ function triggerValidateDocument(document: server.TextDocument) {
d = new Delayer<void>(200);
validationDelayer[document.uri] = d;
}
d.trigger(() => {
d.trigger(async() => {
trace('trigger validateTextDocument');
validateTextDocument(connection, document);
delete validationDelayer[document.uri];
forceValidation(connection, document);
});
}

async function forceValidation(connection: server.IConnection, document: server.TextDocument) {
if (validationDelayer[document.uri]) {
await validateTextDocument(connection, document);
delete validationDelayer[document.uri];
}
}

function tslintConfigurationValid(): boolean {
try {
documents.all().forEach((each) => {
Expand Down Expand Up @@ -954,6 +960,14 @@ connection.onRequest(AllFixesRequest.type, async (params) => {
let result: AllFixesResult | undefined = undefined;
let uri = params.textDocument.uri;
let isOnSave = params.isOnSave;
let document = documents.get(uri);

if (!document) {
return undefined;
}

await forceValidation(connection, document);

let documentFixes = codeFixActions[uri];
let documentVersion: number = -1;
let settings = await settingsCache.get(uri);
Expand Down
7 changes: 5 additions & 2 deletions tslint-tests/.vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,14 @@
"gulp.autoDetect": "off",
"files.autoSave": "off",
// "tslint.autoFixOnSave": [
// "arrow-parens"
// "comment-format"
// ],
// "editor.codeActionsOnSave": {
// "source.organizeImports": true
// },
//"tslint.run": "onSave",
//"tslint.packageManager": "yarn",
"tslint.autoFixOnSave": false,
// "tslint.autoFixOnSave": false,
//"tslint.nodePath": "tmp",
"tslint.jsEnable": true
//"tslint.rulesDirectory": ["tmp1", "tmp2"],
Expand Down
10 changes: 7 additions & 3 deletions tslint-tests/tests/array-type.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
let t: Array<string> = new Array<string>();

console.log(t);
let t: Array<string> = new Array<string>();

console.log(t);

export function hello() {

}
3 changes: 2 additions & 1 deletion tslint-tests/tests/comment-format.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// VS Code provided fix
// import { hello } from "./array-type";

//start with space
//start with space

0 comments on commit 741f9dd

Please sign in to comment.