Skip to content

Commit

Permalink
Merge f360532 into 3ef1d7a
Browse files Browse the repository at this point in the history
  • Loading branch information
williamthome committed Jul 9, 2022
2 parents 3ef1d7a + f360532 commit 220a7bb
Show file tree
Hide file tree
Showing 115 changed files with 16,469 additions and 5,598 deletions.
56 changes: 43 additions & 13 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,50 @@
"ecmaVersion": 6,
"sourceType": "module"
},
"plugins": [
"@typescript-eslint"
"plugins": ["@typescript-eslint"],
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"prettier"
],
"rules": {
"@typescript-eslint/naming-convention": "warn",
"@typescript-eslint/semi": "warn",
"curly": "warn",
"eqeqeq": "warn",
"no-throw-literal": "warn",
"semi": "off"
"@typescript-eslint/naming-convention": "error",
"@typescript-eslint/semi": "error",
"curly": "error",
"eqeqeq": "error",
"no-throw-literal": "error",
"object-curly-newline": [
"error",
{
"ObjectExpression": {
"multiline": true,
"consistent": true
},
"ObjectPattern": {
"multiline": true,
"consistent": true
},
"ImportDeclaration": {
"multiline": true,
"consistent": true
},
"ExportDeclaration": {
"multiline": true,
"consistent": true
}
}
],
"comma-dangle": [2, "always-multiline"],
"max-len": [
"error",
{
"code": 80,
"ignoreTemplateLiterals": true,
"ignoreStrings": true,
"ignoreComments": true,
"ignoreRegExpLiterals": true
}
]
},
"ignorePatterns": [
"out",
"dist",
"**/*.d.ts"
]
"ignorePatterns": ["out", "dist", "**/*.d.ts"]
}
81 changes: 81 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
name: CI

on:
push:
branches: [main]

pull_request:
branches: [main]

jobs:
build:
strategy:
matrix:
os: [macos-latest, ubuntu-latest, windows-latest]
node-version: [16.10.x, 17.x, 18.x]

runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}

- name: Install dependencies
run: npm ci

- name: Build
run: npm run compile

- name: Run tests
uses: GabrielBB/xvfb-action@v1.0
with:
run: npm run test:ci

- name: Coveralls
# TODO: Check why Coveralls fails on Windows OS
if: runner.os != 'Windows'
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
parallel: true
flag-name: run-os-${{ matrix.os }}-node-${{ matrix.node-version }}

finish:
needs: build

runs-on: ubuntu-latest

steps:
- name: Coveralls finished
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
parallel-finished: true

publish:
if: startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/pre-release'

needs: build

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: ^16.10
registry-url: 'https://registry.npmjs.org'

- name: Install vsce
run: npm i -g vsce

- name: Publish to marketplace
if: startsWith(github.ref, 'refs/tags/v')
run: vsce publish -p ${{ secrets.VSCE_PAT }}

- name: Publish pre-release to marketplace
if: github.ref == 'refs/heads/pre-release'
run: vsce publish -p ${{ secrets.VSCE_PAT }} --pre-release
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@ dist
node_modules
.vscode-test/
*.vsix
.eslintcache
coverage
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npx lint-staged
4 changes: 4 additions & 0 deletions .lintstagedrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"*.ts": "npm run prettify",
"*.json": "npm run format"
}
17 changes: 17 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"endOfLine": "lf",
"printWidth": 80,
"semi": true,
"singleQuote": true,
"tabWidth": 4,
"trailingComma": "all",
"useTabs": false,
"overrides": [
{
"files": "*.ts",
"options": {
"parser": "typescript"
}
}
]
}
83 changes: 55 additions & 28 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,32 +3,59 @@
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
{
"version": "0.2.0",
"configurations": [
{
"name": "Run Extension",
"type": "extensionHost",
"request": "launch",
"args": [
"--extensionDevelopmentPath=${workspaceFolder}"
],
"outFiles": [
"${workspaceFolder}/out/**/*.js"
],
"preLaunchTask": "${defaultBuildTask}"
},
{
"name": "Extension Tests",
"type": "extensionHost",
"request": "launch",
"args": [
"--extensionDevelopmentPath=${workspaceFolder}",
"--extensionTestsPath=${workspaceFolder}/out/test/suite/index"
],
"outFiles": [
"${workspaceFolder}/out/test/**/*.js"
],
"preLaunchTask": "${defaultBuildTask}"
}
]
"version": "0.2.0",
"configurations": [
{
"name": "Run Extension",
"type": "extensionHost",
"request": "launch",
"args": ["--extensionDevelopmentPath=${workspaceFolder}"],
"outFiles": ["${workspaceFolder}/out/**/*.js"],
"preLaunchTask": "${defaultBuildTask}"
},
{
"name": "Extension Tests",
"type": "extensionHost",
"request": "launch",
"args": [
"--extensionDevelopmentPath=${workspaceFolder}",
"--extensionTestsPath=${workspaceFolder}/out/test/suite/index"
],
"outFiles": ["${workspaceFolder}/out/test/**/*.js"],
"preLaunchTask": "${defaultBuildTask}"
},
{
"type": "node",
"request": "launch",
"name": "Jest: Single run all tests",
"program": "${workspaceRoot}/node_modules/jest/bin/jest.js",
"args": ["--verbose", "-i", "--no-cache"],
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen"
},
{
"type": "node",
"request": "launch",
"name": "Jest: Watch all tests",
"program": "${workspaceRoot}/node_modules/jest/bin/jest.js",
"args": ["--verbose", "-i", "--no-cache", "--watchAll"],
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen"
},
{
"type": "node",
"request": "launch",
"name": "Jest: Watch current file",
"program": "${workspaceFolder}/node_modules/jest/bin/jest",
"args": [
"${fileBasename}",
"--verbose",
"-i",
"--no-cache",
"--watchAll"
],
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen"
}
]
}
49 changes: 37 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
[!["Sponsor"](https://img.shields.io/static/v1?label=Sponsor&message=%E2%9D%A4&logo=GitHub&color=%23fe8e86)]([https://www.buymeacoffee.com/williamthome](https://github.com/sponsors/williamthome))
[!["Sponsor"](https://img.shields.io/static/v1?label=Sponsor&message=%E2%9D%A4&logo=GitHub&color=%23fe8e86)](<[https://www.buymeacoffee.com/williamthome](https://github.com/sponsors/williamthome)>)
![GitHub Repo stars](https://img.shields.io/github/stars/williamthome/zotonic-ls?style=social)
![License](https://img.shields.io/github/license/williamthome/zotonic-ls)
![GitHub CI Status](https://img.shields.io/github/workflow/status/williamthome/zotonic-ls/ci)
![Lines of code](https://img.shields.io/tokei/lines/github/williamthome/zotonic-ls)
[![Coverage Status](https://coveralls.io/repos/github/williamthome/zotonic-ls/badge.svg?branch=main)](https://coveralls.io/github/williamthome/zotonic-ls?branch=main)
[![Known Vulnerabilities](https://snyk.io/test/github/williamthome/zotonic-ls/badge.svg)](https://snyk.io/test/github/williamthome/zotonic-ls)
![Visual Studio Marketplace Version](https://img.shields.io/visual-studio-marketplace/v/williamthome.zotonic-ls)
![Visual Studio Marketplace Installs](https://img.shields.io/visual-studio-marketplace/i/williamthome.zotonic-ls)
![Visual Studio Marketplace Rating (Stars)](https://img.shields.io/visual-studio-marketplace/stars/williamthome.zotonic-ls)

# Zotonic Language Server

Expand Down Expand Up @@ -28,7 +37,7 @@ A great help is the models snippets. Typing `m.` all models are listed and picki

#### Other languages completions

- HTML: Typing `<` outside a `.tpl` expression popups HTML snippets.
- HTML: Typing `<` outside a `.tpl` expression popups HTML snippets.

### Go to definition

Expand All @@ -52,20 +61,20 @@ Download and install the extension for free at the [Visual Studio Marketplace](h

### Syntax Highlight

- Improve semantic highlight. See:
- [Writing a TextMate Grammar: Some Lessons Learned](https://www.apeth.com/nonblog/stories/textmatebundle.html)
- [Semantic Highlight Guide](https://code.visualstudio.com/api/language-extensions/semantic-highlight-guide)
- Improve semantic highlight. See:
- [Writing a TextMate Grammar: Some Lessons Learned](https://www.apeth.com/nonblog/stories/textmatebundle.html)
- [Semantic Highlight Guide](https://code.visualstudio.com/api/language-extensions/semantic-highlight-guide)

### Snippets

- Review arguments and tabstops;
- CSS completions;
- Javascript completions.
- Review arguments and tabstops;
- CSS completions;
- Javascript completions.

### Docs

- Review links;
- Improve style.
- Review links;
- Improve style.

## Sponsors

Expand Down Expand Up @@ -93,11 +102,27 @@ npm install
code .
```

Make sure you have [ESlint](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint) extension installed.
### Extensions

Make sure you have [ESlint](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint) and [Prettier ESLint](https://marketplace.visualstudio.com/items?itemName=rvest.vs-code-prettier-eslint) extensions installed.

Optionally you can install the [Todo Tree](https://marketplace.visualstudio.com/items?itemName=Gruntfuggly.todo-tree) extension to see things <span style="color: green;">_TODO_</span>, to <span style="color: yellow;">_FIXME_</span>, or <span style="color: red;">_BUG_</span>.

#### Config

- Open user or workspace `settings.json` by:
- Windows/Linux: <kbd>CTRL</kbd> + <kbd>SHIFT</kbd> + <kbd>P</kbd> or `File > Preferences > Settings`
- MacOS: <kbd>CMD</kbd> + <kbd>SHIFT</kbd> + <kbd>P</kbd> or `Code > Preferences > Settings`
- Add this to the settings file:

```json
"editor.defaultFormatter": "rvest.vs-code-prettier-eslint",
"editor.formatOnSave": true,
```

### Debugging the extension

Press <kbd>F5</kbd> to start debugging.
To reload, if in dev window, press <kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>F5</kbd> or, if in extension host window, <kbd>Ctrl</kbd> + <kbd>R</kbd>.
To reload, if in dev window, press <kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>F5</kbd> or, if in extension host window, <kbd>Ctrl</kbd> + <kbd>R</kbd>.

[See this article](https://code.visualstudio.com/api/get-started/your-first-extension) for more information about debugging.

0 comments on commit 220a7bb

Please sign in to comment.