Skip to content

Commit a65aedc

Browse files
M.K. SafiM.K. Safi
authored andcommitted
Move eslintrc and tslint and Prettierify some files
1 parent 6af438d commit a65aedc

File tree

5 files changed

+98
-36
lines changed

5 files changed

+98
-36
lines changed

eslintrc.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"extends": ["eslint:recommended"],
3+
"plugins": ["json"]
4+
}

notes.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ The following is the functionality that I need to add to VS Code to bring it to
66
- [ ] Continue comment on new line
77
- [ ] Add syntax highlighting to CSS
88
- [ ] Move through tabs of current editor group only
9+
- [ ] The highlight in the Explorer moves back to the open file after deleting a file that's highlighted. This is annoying
910
- [ ] Set title bar active and inactive colors https://code.visualstudio.com/docs/getstarted/theme-color-reference#_title-bar-colors-macos
1011
- [ ] Copy line keyboard shortcut. cmd+c on IntelliJ.
1112
- [ ] Change the color of types to orange

tslint.json

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
{
2+
"extends": ["tslint:recommended", "tslint-microsoft-contrib", "tslint-eslint-rules"],
3+
"rules": {
4+
"no-suspicious-comment": false,
5+
"no-conditional-assignment": false,
6+
"no-parameter-properties": false,
7+
"no-backbone-get-set-outside-model": false,
8+
"no-relative-imports": false,
9+
"typedef": [false],
10+
"return-undefined": false,
11+
"no-unused-variable": [false],
12+
"strict-type-predicates": false,
13+
"function-name": false,
14+
"no-increment-decrement": false,
15+
"no-use-before-declare": false,
16+
"no-cookies": false,
17+
"await-promise": false,
18+
"no-floating-promises": false,
19+
"no-for-in-array": false,
20+
"promise-function-async": false,
21+
"restrict-plus-operands": false,
22+
"completed-docs": [false],
23+
"match-default-export-name": false,
24+
"no-unnecessary-qualifier": false,
25+
"no-void-expression": false,
26+
"no-unsafe-any": false,
27+
"strict-boolean-expressions": false,
28+
"missing-jsdoc": false,
29+
"trailing-comma": [
30+
true,
31+
{
32+
"multiline": "always",
33+
"singleline": "never"
34+
}
35+
],
36+
"import-name": false,
37+
"export-name": false,
38+
"no-import-side-effect": false,
39+
"misnamed-import": false,
40+
"restrict-plus-operand": false,
41+
"no-single-line-block-comment": false,
42+
"newline-before-return": false,
43+
"react-unused-props-and-state": false,
44+
"react-tsx-curly-spacing": false,
45+
"no-any": false,
46+
"jsx-boolean-value": false,
47+
"prefer-type-cast": false,
48+
"no-reserved-keywords": false,
49+
"object-literal-sort-keys": false,
50+
"ordered-imports": false,
51+
"no-var-requires": false,
52+
"interface-name": [true, "never-prefix"],
53+
"semicolon": [true, "always"],
54+
"no-console": [false],
55+
"no-require-imports": false,
56+
"space-before-function-paren": [true, "never"],
57+
"whitespace": [false],
58+
"object-curly-spacing": [true, "always"]
59+
}
60+
}

xvscMisc/src/deleteToTextBeginning.ts

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,16 @@
1-
import * as c from 'vscode';
2-
import * as shelljs from 'shelljs'
3-
import * as _ from 'lodash'
1+
import { TextEditor, Range } from 'vscode';
42

5-
export const deleteToTextBeginning = () => {
6-
const activeTextEditor = c.window.activeTextEditor
7-
8-
activeTextEditor.edit((textEditorEdit) => {
9-
textEditorEdit.delete(new c.Range(
10-
activeTextEditor.selection.end.line,
11-
activeTextEditor.document.lineAt(
12-
activeTextEditor.selection.end.line
13-
).firstNonWhitespaceCharacterIndex,
14-
activeTextEditor.selection.end.line,
15-
activeTextEditor.selection.end.character,
16-
))
17-
})
18-
}
3+
export const deleteToTextBeginning = (textEditor: TextEditor) => {
4+
const { selection } = textEditor;
5+
6+
textEditor.edit(textEditorEdit => {
7+
textEditorEdit.delete(
8+
new Range(
9+
selection.end.line,
10+
textEditor.document.lineAt(selection.end.line).firstNonWhitespaceCharacterIndex,
11+
selection.end.line,
12+
selection.end.character,
13+
),
14+
);
15+
});
16+
};

xvscMisc/src/extension.ts

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,31 @@
1-
'use strict'
2-
import {ExtensionContext, commands, window} from 'vscode'
3-
import {openInSourceTree} from './openInSourceTree'
4-
import {deleteToTextBeginning} from './deleteToTextBeginning'
1+
'use strict';
2+
import { ExtensionContext, commands, window } from 'vscode';
3+
import { openInSourceTree } from './openInSourceTree';
4+
import { deleteToTextBeginning } from './deleteToTextBeginning';
55

66
export function activate(context: ExtensionContext) {
7-
const withContext = (fn: Function) => (...args) => fn(context, ...args)
8-
const {registerCommand, registerTextEditorCommand} = commands
9-
const storage = context.workspaceState
10-
const isActiveEditor = window.activeTextEditor !== undefined
11-
const hasSwitchedLayout = storage.get('hasSwitched')
7+
const { registerCommand, registerTextEditorCommand } = commands;
8+
const storage = context.workspaceState;
9+
const isActiveEditor = window.activeTextEditor !== undefined;
10+
const hasSwitchedLayout = storage.get('hasSwitched');
1211
const handleLayoutSwitch = () => {
1312
if (!hasSwitchedLayout) {
14-
commands.executeCommand('workbench.action.toggleEditorGroupLayout')
15-
storage.update('hasSwitched', true)
13+
commands.executeCommand('workbench.action.toggleEditorGroupLayout');
14+
storage.update('hasSwitched', true);
1615
}
17-
}
16+
};
1817

1918
if (isActiveEditor) {
20-
handleLayoutSwitch()
19+
handleLayoutSwitch();
2120
} else {
2221
const registration = window.onDidChangeActiveTextEditor(() => {
23-
handleLayoutSwitch()
24-
registration.dispose()
25-
})
22+
handleLayoutSwitch();
23+
registration.dispose();
24+
});
2625
}
2726

2827
context.subscriptions.push(
29-
registerTextEditorCommand('xvscm.openInSourceTree', withContext(openInSourceTree)),
30-
registerTextEditorCommand('xvscm.deleteToTextBeginning', withContext(deleteToTextBeginning)),
31-
)
28+
registerTextEditorCommand('xvscm.openInSourceTree', openInSourceTree),
29+
registerTextEditorCommand('xvscm.deleteToTextBeginning', deleteToTextBeginning),
30+
);
3231
}

0 commit comments

Comments
 (0)