Skip to content

Commit

Permalink
Add code formatting for VS Code extension
Browse files Browse the repository at this point in the history
Ref. eng/recordflux/RecordFlux#1397
  • Loading branch information
treiher committed Jan 5, 2024
1 parent 879d772 commit fcfc2b6
Show file tree
Hide file tree
Showing 28 changed files with 948 additions and 856 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ test_tools:
test_ide:
$(PYTEST) tests/ide
# TODO(eng/recordflux/RecordFlux#1361): Execute `test` instead of `build`
$(MAKE) -C ide/vscode build
$(MAKE) -C ide/vscode check build

test_optimized:
PYTHONOPTIMIZE=1 $(PYTEST) tests/unit tests/integration tests/compilation
Expand Down
29 changes: 12 additions & 17 deletions ide/vscode/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,15 @@
/**@type {import('eslint').Linter.Config} */
// eslint-disable-next-line no-undef
module.exports = {
root: true,
parser: '@typescript-eslint/parser',
plugins: [
'@typescript-eslint',
],
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
],
rules: {
'semi': [2, "always"],
'@typescript-eslint/no-unused-vars': 0,
'@typescript-eslint/no-explicit-any': 0,
'@typescript-eslint/explicit-module-boundary-types': 0,
'@typescript-eslint/no-non-null-assertion': 0,
}
};
root: true,
parser: "@typescript-eslint/parser",
plugins: ["@typescript-eslint"],
extends: ["eslint:recommended", "plugin:@typescript-eslint/recommended"],
rules: {
semi: [2, "always"],
"@typescript-eslint/no-unused-vars": 0,
"@typescript-eslint/no-explicit-any": 0,
"@typescript-eslint/explicit-module-boundary-types": 0,
"@typescript-eslint/no-non-null-assertion": 0,
},
};
4 changes: 4 additions & 0 deletions ide/vscode/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
*.md
node_modules
out
package-lock.json
10 changes: 4 additions & 6 deletions ide/vscode/.vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
{
// See https://go.microsoft.com/fwlink/?LinkId=827846 to learn about workspace recommendations.
// Extension identifier format: ${publisher}.${name}. Example: vscode.csharp
// See https://go.microsoft.com/fwlink/?LinkId=827846 to learn about workspace recommendations.
// Extension identifier format: ${publisher}.${name}. Example: vscode.csharp

// List of extensions which should be recommended for users of this workspace.
"recommendations": [
"dbaeumer.vscode-eslint"
]
// List of extensions which should be recommended for users of this workspace.
"recommendations": ["dbaeumer.vscode-eslint"]
}
58 changes: 26 additions & 32 deletions ide/vscode/.vscode/launch.json
Original file line number Diff line number Diff line change
@@ -1,35 +1,29 @@
// A launch configuration that compiles the extension and then opens it inside a new window
{
"version": "0.2.0",
"configurations": [
{
"type": "extensionHost",
"request": "launch",
"name": "Launch Client",
"runtimeExecutable": "${execPath}",
"args": [
"--extensionDevelopmentPath=${workspaceRoot}"
],
"sourceMaps": true,
"outFiles": [
"${workspaceRoot}/out/**/*.js"
],
"preLaunchTask": "npm: watch:client"
},
{
"name": "Language Server E2E Test",
"type": "extensionHost",
"request": "launch",
"runtimeExecutable": "${execPath}",
"args": [
"--extensionDevelopmentPath=${workspaceRoot}",
"--extensionTestsPath=${workspaceRoot}/out/test",
"${workspaceRoot}/testFixture"
],
"sourceMaps": true,
"outFiles": [
"${workspaceRoot}/out/test/**/*.js"
]
}
]
"version": "0.2.0",
"configurations": [
{
"type": "extensionHost",
"request": "launch",
"name": "Launch Client",
"runtimeExecutable": "${execPath}",
"args": ["--extensionDevelopmentPath=${workspaceRoot}"],
"sourceMaps": true,
"outFiles": ["${workspaceRoot}/out/**/*.js"],
"preLaunchTask": "npm: watch:client"
},
{
"name": "Language Server E2E Test",
"type": "extensionHost",
"request": "launch",
"runtimeExecutable": "${execPath}",
"args": [
"--extensionDevelopmentPath=${workspaceRoot}",
"--extensionTestsPath=${workspaceRoot}/out/test",
"${workspaceRoot}/testFixture"
],
"sourceMaps": true,
"outFiles": ["${workspaceRoot}/out/test/**/*.js"]
}
]
}
14 changes: 6 additions & 8 deletions ide/vscode/.vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
{
"editor.insertSpaces": false,
"[python]": {
"editor.defaultFormatter": "ms-python.black-formatter"
},
"python.formatting.provider": "none",
"python.analysis.extraPaths": [
"./server/src"
]
"editor.insertSpaces": false,
"[python]": {
"editor.defaultFormatter": "ms-python.black-formatter"
},
"python.formatting.provider": "none",
"python.analysis.extraPaths": ["./server/src"]
}
100 changes: 48 additions & 52 deletions ide/vscode/.vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -1,54 +1,50 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "compile",
"dependsOn": [
{
"type": "npm",
"script": "compile:client"
}
],
"problemMatcher": []
},
{
"type": "npm",
"script": "compile:client",
"group": "build",
"presentation": {
"panel": "dedicated",
"reveal": "never"
},
"problemMatcher": [
"$tsc"
]
},
{
"label": "watch",
"dependsOn": [
{
"type": "npm",
"script": "watch:client"
}
],
"group": {
"kind": "build",
"isDefault": true
},
"problemMatcher": []
},
{
"type": "npm",
"script": "watch:client",
"isBackground": true,
"group": "build",
"presentation": {
"panel": "dedicated",
"reveal": "never"
},
"problemMatcher": [
"$tsc-watch"
]
}
]
"version": "2.0.0",
"tasks": [
{
"label": "compile",
"dependsOn": [
{
"type": "npm",
"script": "compile:client"
}
],
"problemMatcher": []
},
{
"type": "npm",
"script": "compile:client",
"group": "build",
"presentation": {
"panel": "dedicated",
"reveal": "never"
},
"problemMatcher": ["$tsc"]
},
{
"label": "watch",
"dependsOn": [
{
"type": "npm",
"script": "watch:client"
}
],
"group": {
"kind": "build",
"isDefault": true
},
"problemMatcher": []
},
{
"type": "npm",
"script": "watch:client",
"isBackground": true,
"group": "build",
"presentation": {
"panel": "dedicated",
"reveal": "never"
},
"problemMatcher": ["$tsc-watch"]
}
]
}
12 changes: 11 additions & 1 deletion ide/vscode/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ VSIX ?= recordflux.vsix

.PHONY: all

all: test
all: check test

.PHONY: dist

Expand All @@ -27,6 +27,16 @@ node_modules: package.json
out/extension.js: src/extension.ts $(wildcard tests/*.ts)
npm run compile

.PHONY: check

check: node_modules
npx prettier -c .

.PHONY: format

format:
npx prettier -w .

.PHONY: test

test: node_modules out/extension.js
Expand Down
67 changes: 14 additions & 53 deletions ide/vscode/language-configuration.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,63 +5,24 @@
},
// symbols used as brackets
"brackets": [
[
"{",
"}"
],
[
"[",
"]"
],
[
"(",
")"
]
["{", "}"],
["[", "]"],
["(", ")"]
],
// symbols that are auto closed when typing
"autoClosingPairs": [
[
"{",
"}"
],
[
"[",
"]"
],
[
"(",
")"
],
[
"\"",
"\""
],
[
"'",
"'"
]
["{", "}"],
["[", "]"],
["(", ")"],
["\"", "\""],
["'", "'"]
],
// symbols that can be used to surround a selection
"surroundingPairs": [
[
"{",
"}"
],
[
"[",
"]"
],
[
"(",
")"
],
[
"\"",
"\""
],
[
"'",
"'"
]
["{", "}"],
["[", "]"],
["(", ")"],
["\"", "\""],
["'", "'"]
]
}
}
16 changes: 16 additions & 0 deletions ide/vscode/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit fcfc2b6

Please sign in to comment.