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

Commit

Permalink
Tweaks to PR #231
Browse files Browse the repository at this point in the history
  • Loading branch information
egamma committed Jul 24, 2017
1 parent 3dcec2a commit f5ffdb5
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 2,561 deletions.
5 changes: 3 additions & 2 deletions tslint-server/src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -907,6 +907,7 @@ namespace AllFixesRequest {
connection.onRequest(AllFixesRequest.type, (params) => {
let result: AllFixesResult = null;
let uri = params.textDocument.uri;
let isOnSave = params.isOnSave;
let documentFixes = codeFixActions[uri];
let documentVersion: number = -1;

Expand All @@ -923,8 +924,8 @@ connection.onRequest(AllFixesRequest.type, (params) => {
}
}

// Filter out fixes for problems that aren't set to be autofixable on save
if (params.isOnSave && Array.isArray(settings.tslint.autoFixOnSave)) {
// Filter out fixes for problems that aren't defined to be autofixable on save
if (isOnSave && Array.isArray(settings.tslint.autoFixOnSave)) {
const autoFixOnSave = settings.tslint.autoFixOnSave as Array<string>;
fixes = fixes.filter(fix => autoFixOnSave.indexOf(fix.problem.getRuleName()) > -1);
}
Expand Down
7 changes: 4 additions & 3 deletions tslint-tests/.vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
// Place your settings in this file to overwrite default and user settings.
{
"files.autoSave": "off",
"tslint.autoFixOnSave": [
"arrow-parens"
],
// "tslint.autoFixOnSave": [
// "arrow-parens"
// ],
"tslint.autoFixOnSave": false,
// "tslint.nodePath": "c:\\tmp",
"tslint.jsEnable": true
// "tslint.trace.server": "verbose"
Expand Down
2 changes: 2 additions & 0 deletions tslint-tests/debug.log
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[0724/103800.682:ERROR:tcp_listen_socket.cc(76)] Could not bind socket to 127.0.0.1:6010
[0724/103800.693:ERROR:node_debugger.cc(87)] Cannot start debugger server
5 changes: 4 additions & 1 deletion tslint-tests/tests/selective-auto-fix-on-save.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
let z = 'quotemark';
// Only the 'arrow-parens' rule should be fixed, the 'quotemark' failure
// should not be fixed
// "tslint.autoFixOnSave": ["arrow-parens"],

[1, 2].map(num => console.log('test: ' + num));

4 changes: 4 additions & 0 deletions tslint/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@

## 0.17.0
- Added support to define which auto fixes should be applied automatically on save [#152](https://github.com/Microsoft/vscode-tslint/issues/152).

## 0.16.0
- Added quick fix to show the documentation of a rule.
- Added description to the contributed variables `tslint4` and `tslint5`.
Expand Down
Loading

0 comments on commit f5ffdb5

Please sign in to comment.