forked from anza-xyz/move
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a VS Code extension for Move that provides a TextMate grammar to perform syntax highlighting. To make maintaining the grammar easier, include tests written in TypeScript. Closes: #9299
- Loading branch information
1 parent
68ea824
commit a3ccc8e
Showing
45 changed files
with
16,214 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -945,6 +945,44 @@ jobs: | |
path: | | ||
/tmp/benches | ||
build-move-analyzer-vscode-extension: | ||
name: Build VS Code extension for move-analyzer | ||
runs-on: ubuntu-latest | ||
needs: | ||
- prepare | ||
steps: | ||
- uses: actions/[email protected] | ||
with: | ||
ref: ${{ github.event.pull_request.head.sha }} | ||
- name: Use Node.js 14 | ||
uses: actions/[email protected] | ||
with: | ||
node-version: '14' | ||
- name: Install NPM dependencies | ||
working-directory: language/move-analyzer/editors/code | ||
run: npm install | ||
- name: Build the extension | ||
working-directory: language/move-analyzer/editors/code | ||
run: npm run pretest | ||
- name: Test the extension | ||
# VS Code tests require display output. This action simulates such a | ||
# display, using Xvfb. (It's roughly equivalent to prefixing the 'run' | ||
# commands below with `xvfb-run <command>`.) Without a simulated display | ||
# such as this one, the tests would fail with the error message: | ||
# "Unable to open X display." | ||
uses: GabrielBB/[email protected] | ||
with: | ||
working-directory: language/move-analyzer/editors/code | ||
run: npm run test | ||
- name: Package the extension | ||
working-directory: language/move-analyzer/editors/code | ||
run: npm run package | ||
- name: Upload VS Code extension | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: move-analyzer-vscode-extension | ||
path: language/move-analyzer/editors/code/move-analyzer.vsix | ||
|
||
developers-site: | ||
name: run-developer-site-build | ||
runs-on: ubuntu-latest | ||
|
@@ -956,7 +994,7 @@ jobs: | |
ref: ${{ github.event.pull_request.head.sha }} | ||
- uses: actions/[email protected] | ||
# Installs node and yarn | ||
- name: Use Node.js 12 | ||
- name: Use Node.js 14 | ||
uses: actions/[email protected] | ||
with: | ||
node-version: '14' | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
// This file defines launch configurations for Visual Studio Code. | ||
// | ||
// When VS Code is used to open the directory containing this repository (which contains this launch | ||
// configuration at its root), it reads the values in this file and presents the user with launch | ||
// options in its "Run and Debug" view. | ||
// | ||
// The launch configurations below allow the VS Code user to, for example: | ||
// * Launch a new VS Code window that has the extension in this repository installed and enabled. | ||
// * Launch a new VS Code window to run the extension's tests. | ||
// | ||
// When viewing this file in VS Code, you may use IntelliSense to learn about possible attributes, | ||
// or hover to view descriptions of existing attributes. For more information, visit: | ||
// https://go.microsoft.com/fwlink/?linkid=830387 | ||
{ | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{ | ||
"name": "Launch with Extension", | ||
"type": "extensionHost", | ||
"request": "launch", | ||
"args": [ | ||
"--extensionDevelopmentPath=${workspaceFolder}/language/move-analyzer/editors/code" | ||
] | ||
}, | ||
{ | ||
"name": "VS Code Tokenizer Tests", | ||
"type": "extensionHost", | ||
"request": "launch", | ||
"runtimeExecutable": "${execPath}", | ||
"args": [ | ||
"${workspaceFolder}/language/move-analyzer/editors/code/tests", | ||
"--extensionDevelopmentPath=${workspaceFolder}/language/move-analyzer/editors/code", | ||
"--extensionTestsPath=${workspaceFolder}/language/move-analyzer/editors/code/out/tests/index.js" | ||
], | ||
"outFiles": ["${workspaceFolder}/language/move-analyzer/editors/code/out/tests/**/*.js"], | ||
"preLaunchTask": "Pretest" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// This file define "tasks" that automate parts of a programmer's workflow when | ||
// developing the Visual Studio Code extension in this repository. See | ||
// https://go.microsoft.com/fwlink/?LinkId=733558 for documentation. | ||
{ | ||
"version": "2.0.0", | ||
"tasks": [ | ||
{ | ||
"label": "Pretest", | ||
"group": "build", | ||
"isBackground": false, | ||
"type": "npm", | ||
"script": "pretest", | ||
"path": "language/move-analyzer/editors/code/", | ||
"problemMatcher": { | ||
"base": "$tsc", | ||
"fileLocation": [ | ||
"relative", | ||
"${workspaceFolder}/language/move-analyzer/editors/code/" | ||
] | ||
} | ||
} | ||
] | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
[package] | ||
name = "move-analyzer" | ||
version = "0.0.0" | ||
authors = ["Diem Association <[email protected]>"] | ||
description = "A language server for Move" | ||
repository = "https://github.com/diem/diem" | ||
homepage = "https://diem.com" | ||
license = "Apache-2.0" | ||
publish = false | ||
edition = "2018" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# There's no need for eslint to lint external module dependencies. | ||
node_modules | ||
# eslint lints our pre-compiled source files; it does not need to lint | ||
# build output. | ||
out | ||
# Do not lint TypeScript type declarations. | ||
*.d.ts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,205 @@ | ||
{ | ||
// Don't bother looking for eslint configuration files in parent | ||
// directories; this is the root configuration. | ||
"root": true, | ||
|
||
// Instruct eslint to use a parser that can parse TypeScript. | ||
"parser": "@typescript-eslint/parser", | ||
"parserOptions": { | ||
// Match the ECMAScript standard specified in our TypeScript config. | ||
"ecmaVersion": "2020", | ||
// Use ECMAScript modules. | ||
"sourceType": "module", | ||
// To type-check while linting, specify the TypeScript compiler be | ||
// invoked from the same directory as this lint configuration file, | ||
// using the TypeScript configuration file at the "project" path. | ||
"tsconfigRootDir": ".", | ||
"project": [ | ||
"./tsconfig.json" | ||
] | ||
}, | ||
|
||
// Specify the environment in which our JavaScript will run. | ||
"env": { | ||
// The Node.js runtime environment provides globals such as `__dirname`. | ||
"node": true | ||
}, | ||
|
||
// Plug-in eslint rules from @typescript-eslint. | ||
"plugins": [ | ||
"@typescript-eslint" | ||
], | ||
// Use the core rules that eslint and @typescript-eslint recommend. | ||
"extends": [ | ||
"eslint:recommended", | ||
"plugin:@typescript-eslint/recommended", | ||
"plugin:@typescript-eslint/recommended-requiring-type-checking" | ||
], | ||
// Enable some additional rules beyond the recommended ones. | ||
// For more information, see: https://eslint.org/docs/rules/ | ||
"rules": { | ||
// The following are in the "possible errors" category of eslint rules. | ||
"no-promise-executor-return": "warn", | ||
"no-template-curly-in-string": "warn", | ||
"no-unreachable-loop": "warn", | ||
"no-unsafe-optional-chaining": "warn", | ||
"no-useless-backreference": "warn", | ||
"require-atomic-updates": "warn", | ||
|
||
// The following are in the "best practices" category of eslint rules. | ||
"array-callback-return": "warn", | ||
"block-scoped-var": "warn", | ||
"class-methods-use-this": "warn", | ||
"consistent-return": "warn", | ||
"curly": "warn", | ||
"default-case": "warn", | ||
"default-case-last": "warn", | ||
"dot-location": "warn", | ||
"eqeqeq": "warn", | ||
"guard-for-in": "warn", | ||
"no-constructor-return": "warn", | ||
"no-else-return": "warn", | ||
"no-eq-null": "warn", | ||
"no-eval": "warn", | ||
"no-extend-native": "warn", | ||
"no-extra-bind": "warn", | ||
"no-extra-label": "warn", | ||
"no-floating-decimal": "warn", | ||
"no-implicit-coercion": "warn", | ||
"no-implicit-globals": "warn", | ||
"no-labels": "warn", | ||
"no-lone-blocks": "warn", | ||
"no-multi-spaces": "warn", | ||
"no-nonoctal-decimal-escape": "warn", | ||
"no-octal-escape": "warn", | ||
"no-param-reassign": "warn", | ||
"no-return-assign": "warn", | ||
"no-script-url": "warn", | ||
"no-self-compare": "warn", | ||
"no-sequences": "warn", | ||
"no-throw-literal": "warn", | ||
"no-unmodified-loop-condition": "warn", | ||
"no-useless-call": "warn", | ||
"no-useless-concat": "warn", | ||
"no-useless-return": "warn", | ||
"prefer-promise-reject-errors": "warn", | ||
"radix": "warn", | ||
|
||
// The following are in the "stylistic issues" category of eslint rules. | ||
"array-bracket-spacing": "warn", | ||
"array-element-newline": [ | ||
"warn", | ||
"consistent" | ||
], | ||
"block-spacing": "warn", | ||
"capitalized-comments": [ | ||
"warn", | ||
"always", | ||
{ | ||
"ignoreConsecutiveComments": true | ||
} | ||
], | ||
"comma-style": "warn", | ||
"computed-property-spacing": "warn", | ||
"eol-last": "warn", | ||
"function-call-argument-newline": ["warn", "consistent"], | ||
"function-paren-newline": ["warn", "consistent"], | ||
"key-spacing": "warn", | ||
"linebreak-style": "warn", | ||
"max-len": [ | ||
"warn", | ||
{ | ||
"code": 100, | ||
"ignoreUrls": true | ||
} | ||
], | ||
"new-cap": "warn", | ||
"new-parens": "warn", | ||
"no-lonely-if": "warn", | ||
"no-mixed-operators": "warn", | ||
"no-multi-assign": "warn", | ||
"no-multiple-empty-lines": "warn", | ||
"no-negated-condition": "warn", | ||
"no-new-object": "warn", | ||
"no-tabs": "warn", | ||
"no-trailing-spaces": "warn", | ||
"no-unneeded-ternary": "warn", | ||
"no-whitespace-before-property": "warn", | ||
"prefer-exponentiation-operator": "warn", | ||
"prefer-object-spread": "warn", | ||
"semi-spacing": "warn", | ||
"semi-style": "warn", | ||
"space-in-parens": "warn", | ||
"spaced-comment": "warn", | ||
"switch-colon-spacing": "warn", | ||
"unicode-bom": "warn", | ||
|
||
// The following are @typescript-eslint rules. For more information, see: | ||
// * All @typescript-eslint rules: https://github.com/typescript-eslint/typescript-eslint/tree/v4.31.1/packages/eslint-plugin/docs/rules | ||
// * The rules included in @typescript-eslint/recommended: https://github.com/typescript-eslint/typescript-eslint/blob/v4.31.1/packages/eslint-plugin/src/configs/recommended.ts | ||
// * The rules included in @typescript-eslint/recommended-requiring-type-checking: https://github.com/typescript-eslint/typescript-eslint/blob/v4.31.1/packages/eslint-plugin/src/configs/recommended-requiring-type-checking.ts | ||
"@typescript-eslint/array-type": ["warn", { "default": "generic" }], | ||
"@typescript-eslint/ban-tslint-comment": "warn", | ||
"@typescript-eslint/brace-style": "warn", | ||
"@typescript-eslint/comma-dangle": [ | ||
"warn", | ||
"always-multiline" | ||
], | ||
"@typescript-eslint/comma-spacing": "warn", | ||
"@typescript-eslint/consistent-indexed-object-style": "warn", | ||
"@typescript-eslint/consistent-type-assertions": "warn", | ||
"@typescript-eslint/consistent-type-definitions": "warn", | ||
"@typescript-eslint/consistent-type-imports": "warn", | ||
"@typescript-eslint/default-param-last": "warn", | ||
"@typescript-eslint/dot-notation": "warn", | ||
"@typescript-eslint/explicit-function-return-type": "warn", | ||
"@typescript-eslint/func-call-spacing": "warn", | ||
"@typescript-eslint/keyword-spacing": "warn", | ||
"@typescript-eslint/lines-between-class-members": "warn", | ||
"@typescript-eslint/member-delimiter-style": "warn", | ||
"@typescript-eslint/naming-convention": "warn", | ||
"@typescript-eslint/no-base-to-string": "warn", | ||
"@typescript-eslint/no-confusing-non-null-assertion": "warn", | ||
"@typescript-eslint/no-duplicate-imports": "warn", | ||
"@typescript-eslint/no-dynamic-delete": "warn", | ||
"@typescript-eslint/no-extra-parens": "warn", | ||
"@typescript-eslint/no-extraneous-class": "warn", | ||
"@typescript-eslint/no-implicit-any-catch": "warn", | ||
"@typescript-eslint/no-invalid-this": "warn", | ||
"@typescript-eslint/no-invalid-void-type": "warn", | ||
"@typescript-eslint/no-loop-func": "warn", | ||
"@typescript-eslint/no-loss-of-precision": "warn", | ||
"@typescript-eslint/no-meaningless-void-operator": "warn", | ||
"@typescript-eslint/no-redeclare": "warn", | ||
"@typescript-eslint/no-require-imports": "warn", | ||
"@typescript-eslint/no-unnecessary-boolean-literal-compare": "warn", | ||
"@typescript-eslint/no-unnecessary-condition": "warn", | ||
"@typescript-eslint/no-unnecessary-qualifier": "warn", | ||
"@typescript-eslint/no-unnecessary-type-arguments": "warn", | ||
"@typescript-eslint/no-unnecessary-type-constraint": "warn", | ||
"@typescript-eslint/no-unused-expressions": "warn", | ||
"@typescript-eslint/no-use-before-define": "warn", | ||
"@typescript-eslint/non-nullable-type-assertion-style": "warn", | ||
"@typescript-eslint/object-curly-spacing": ["warn", "always"], | ||
"@typescript-eslint/prefer-for-of": "warn", | ||
"@typescript-eslint/prefer-function-type": "warn", | ||
"@typescript-eslint/prefer-includes": "warn", | ||
"@typescript-eslint/prefer-literal-enum-member": "warn", | ||
"@typescript-eslint/prefer-nullish-coalescing": "warn", | ||
"@typescript-eslint/prefer-optional-chain": "warn", | ||
"@typescript-eslint/prefer-readonly-parameter-types": "warn", | ||
"@typescript-eslint/prefer-readonly": "warn", | ||
"@typescript-eslint/prefer-reduce-type-parameter": "warn", | ||
"@typescript-eslint/prefer-string-starts-ends-with": "warn", | ||
"@typescript-eslint/promise-function-async": "warn", | ||
"@typescript-eslint/quotes": ["warn", "single"], | ||
"@typescript-eslint/require-array-sort-compare": "warn", | ||
"@typescript-eslint/return-await": "warn", | ||
"@typescript-eslint/semi": "warn", | ||
"@typescript-eslint/space-before-function-paren": ["warn", "never"], | ||
"@typescript-eslint/strict-boolean-expressions": "warn", | ||
"@typescript-eslint/switch-exhaustiveness-check": "warn", | ||
"@typescript-eslint/type-annotation-spacing": "warn", | ||
"@typescript-eslint/unified-signatures": "warn" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# NPM dependencies | ||
node_modules | ||
# TypeScript build output directory | ||
out | ||
# Tests are run within a VS Code application that is downloaded | ||
# into this directory | ||
.vscode-test | ||
# VS Code extension package (VSIX) archive | ||
*.vsix |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# Rather than listing out what files are *not* included in the extension, | ||
# list out the small subset of files that *are* included. | ||
# For more information on `.vscodeignore` files, see: | ||
# https://code.visualstudio.com/api/working-with-extensions/publishing-extension#.vscodeignore | ||
|
||
**/* | ||
!language-configuration.json | ||
!move.tmLanguage.json | ||
!package-lock.json | ||
!package.json | ||
!README.md |
Oops, something went wrong.