Skip to content

Commit

Permalink
Merge branch 'new-version'
Browse files Browse the repository at this point in the history
  • Loading branch information
jinliming2 committed Jan 18, 2021
2 parents 5142d6d + 1644be7 commit b9e6d53
Show file tree
Hide file tree
Showing 43 changed files with 4,335 additions and 288 deletions.
41 changes: 41 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
module.exports = {
env: {
es6: true,
es2017: true,
es2020: true,
es2021: true,
node: true,
},
root: true,
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaVersion: 2021,
sourceType: 'module',
},
plugins: ['@typescript-eslint'],
'extends': ['eslint:recommended', 'plugin:prettier/recommended', 'prettier/standard', 'prettier/unicorn'],
rules: {
'@typescript-eslint/naming-convention': 'warn',
'@typescript-eslint/semi': 'warn',
curly: 'warn',
eqeqeq: 'warn',
'no-throw-literal': 'warn',
semi: 'off',
'comma-dangle': ['error', 'always-multiline'],
'linebreak-style': ['error', 'unix'],
'no-constant-condition': ['error', { checkLoops: false }],
'no-empty': ['error', { allowEmptyCatch: true }],
quotes: ['error', 'single', { avoidEscape: true }],
'quote-props': ['error', 'as-needed', { keywords: true, unnecessary: true, numbers: true }],
'sort-imports': [
'warn',
{
ignoreCase: true,
ignoreDeclarationSort: true,
ignoreMemberSort: false,
allowSeparatedGroups: true,
},
],
},
overrides: [{ files: ['**/*.test.ts'], env: { mocha: true } }],
};
51 changes: 51 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
on:
- push
- pull_request
jobs:
test:
name: Test on ${{ matrix.os }}
strategy:
matrix:
os:
- macos-latest
- ubuntu-latest
- windows-latest
runs-on: ${{ matrix.os }}
steps:
- name: Fix git line-endings for Windows
if: runner.os == 'Windows'
run: git config --global core.autocrlf false
- name: Checkout
uses: actions/checkout@v2
- name: Install Node.js
uses: actions/setup-node@v2
with:
node-version: 12
- name: Install dependencies
run: yarn
- name: Run test (for Linux)
env:
FORCE_COLOR: '1'
if: runner.os == 'Linux'
run: xvfb-run -a yarn test
- name: Run test
env:
FORCE_COLOR: '1'
if: runner.os != 'Linux'
run: yarn test
- name: Report coverage
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
flag-name: ${{ matrix.os }}
parallel: true
finish:
name: Finish coverage
needs: test
runs-on: ubuntu-latest
steps:
- name: Coveralls finished
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
parallel-finished: true
10 changes: 10 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
out
dist
node_modules
.vscode-test/
*.vsix

/coverage
/.nyc_output

yarn-error.log
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
package.json
14 changes: 14 additions & 0 deletions .prettierrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
module.exports = {
printWidth: 120,
tabWidth: 2,
useTabs: false,
semi: true,
singleQuote: true,
quoteProps: 'preserve',
jsxSingleQuote: false,
trailingComma: 'all',
bracketSpacing: true,
jsxBracketSameLine: false,
arrowParens: 'avoid',
endOfLine: 'lf',
};
8 changes: 8 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
// See http://go.microsoft.com/fwlink/?LinkId=827846
// for the documentation about the extensions.json format
"recommendations": [
"dbaeumer.vscode-eslint",
"esbenp.prettier-vscode"
]
}
41 changes: 27 additions & 14 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,31 @@
// A launch configuration that launches the extension inside a new window
// A launch configuration that compiles the extension and then opens it inside a new window
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
{
"version": "0.2.0",
"configurations": [
{
"name": "Extension",
"type": "extensionHost",
"request": "launch",
"runtimeExecutable": "${execPath}",
"args": [
"--extensionDevelopmentPath=${workspaceFolder}"
]
}
]
}
"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"
],
"env": {
"FORCE_COLOR": "1"
},
"outFiles": ["${workspaceFolder}/out/test/**/*.js"],
"preLaunchTask": "${defaultBuildTask}"
}
]
}
26 changes: 26 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"search.exclude": {
"out": true,
"yarn.lock": true
},
// Turn off tsc task auto detection since we have the necessary tasks as npm scripts
"typescript.tsc.autoDetect": "off",
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.tabSize": 2,
"editor.wrappingIndent": "indent",
"diffEditor.ignoreTrimWhitespace": false,
"files.eol": "\n",
"files.insertFinalNewline": true,
"files.trimFinalNewlines": true,
"files.trimTrailingWhitespace": true,
"eslint.packageManager": "yarn",
"npm.packageManager": "yarn",
"tslint.packageManager": "yarn",
"javascript.preferences.quoteStyle": "single",
"typescript.preferences.quoteStyle": "single",
"editor.formatOnSave": true,
"eslint.alwaysShowStatus": true,
"eslint.format.enable": true,
"eslint.validate": ["javascript", "typescript"],
"typescript.tsdk": "node_modules/typescript/lib"
}
20 changes: 20 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
{
"version": "2.0.0",
"tasks": [
{
"type": "npm",
"script": "watch",
"problemMatcher": "$tsc-watch",
"isBackground": true,
"presentation": {
"reveal": "never"
},
"group": {
"kind": "build",
"isDefault": true
}
}
]
}
9 changes: 9 additions & 0 deletions .vscodeignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
.vscode/**
.vscode-test/**
out/test/**
src/**
.gitignore
.yarnrc
vsc-extension-quickstart.md
**/tsconfig.json
**/.eslintrc.json
**/*.map
**/*.ts

assets/logo.xcf
assets/screenshots
1 change: 1 addition & 0 deletions .yarnrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
--ignore-engines true
23 changes: 23 additions & 0 deletions @types/nyc.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
declare module 'nyc' {
export default class NYC {
constructor(config): void;
instrumenter(): void;
addFile(filename): void;
async addAllFiles(): Promise<void>;
async instrumentAllFiles(input, output): Promise<void>;
maybePurgeSourceMapCache(): void;
async createTempDirectory(): Promise<void>;
async reset(): Promise<void>;
wrap(bin?): void;
writeCoverageFile(): void;
async getCoverageMapFromAllCoverageFiles(baseDirectory): Promise<unknown>;
async report(): Promise<void>;
async writeProcessIndex(): Promise<void>;
async showProcessTree(): Promise<void>;
async checkCoverage(thresholds, perFile): Promise<void>;
coverageFiles(baseDirectory = this.tempDirectory()): Promise<unknown>;
async coverageFileLoad(filename, baseDirectory = this.tempDirectory()): Promise<unknown>;
tempDirectory(): string;
reportDirectory(): string;
}
}
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,30 @@

## [Unreleased]

## [0.1.0] - 2021-01-18

### Added

- Refactor: use semantic API
- Support config for matching file extension / language id (implement using semantic API)

## [0.0.3] - 2020-12-09

### Fixed

- Syntax error when missing template-ending in go source.

## [0.0.2] - 2020-12-09

### Added

- Support syntax highlighting for Go Template embedded in literal string in Go source file.
- Support syntax highlighting for Go Template files: `*.gtpl`.

## [0.0.1] - 2020-09-09

### Added

- Support syntax highlighting for Go Template files: `*.go.txt`, `*.go.tpl`, `*.go.tmpl`.
- Support syntax highlighting for Go Template embedded in `HTML`, `JS`, and `CSS` files.
- Support syntax highlighting for Go Template embedded in unknown extension files which begin with `{{ /* Go Template */ }}`.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2020 Liming Jin
Copyright (c) 2021 Liming Jin

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
34 changes: 15 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
[![GitHub stars](https://img.shields.io/github/stars/jinliming2/vscode-go-template.svg)](https://github.com/jinliming2/vscode-go-template/stargazers)
[![GitHub forks](https://img.shields.io/github/forks/jinliming2/vscode-go-template.svg)](https://github.com/jinliming2/vscode-go-template/network)
[![GitHub issues](https://img.shields.io/github/issues/jinliming2/vscode-go-template.svg)](https://github.com/jinliming2/vscode-go-template/issues)
[![Coverage Status](https://coveralls.io/repos/github/jinliming2/vscode-go-template/badge.svg?branch=master)](https://coveralls.io/github/jinliming2/vscode-go-template?branch=master)

Go Template Syntax Highlight Support for VSCode.

Expand All @@ -17,34 +18,29 @@ Go Template Syntax Highlight Support for VSCode.

- Support syntax highlighting for Go Template embedded in literal string in Go source file.

![Go](./assets/screenshots/go.png)
- Support syntax highlighting for Go Template files: `*.go.txt`, `*.go.tpl`, `*.go.tmpl`, `*.gtpl`.
![Go](./assets/screenshots/go.png)

![Template](./assets/screenshots/tpl.png)
- Support syntax highlighting for Go Template embedded in `HTML`, `JS`, and `CSS` files.
- Support syntax highlighting for Go Template files: `*.go.txt`, `*.go.tpl`, `*.go.tmpl`, `*.gtpl`.

![HTML](./assets/screenshots/html.png)
- Support syntax highlighting for Go Template embedded in unknown extension files which begin with Go Template Comment. Ex: `{{ /* Go Template */ }}`.
![Template](./assets/screenshots/tpl.png)

![Comment](./assets/screenshots/comment.png)
- Support syntax highlighting for Go Template embedded in `HTML`, `JS`, and `CSS` files.

## Known Issues
![HTML](./assets/screenshots/html.png)

1. Template syntax highlighting in JS and CSS files may cause syntax error.
- Support syntax highlighting for Go Template embedded in unknown extension files which begin with Go Template Comment. Ex: `{{ /* Go Template */ }}`.

## Release Notes
![Comment](./assets/screenshots/comment.png)

### 0.0.3 (2020-12-09)
- Support syntax highlighting for any other custom specified file extensions.

- Fix: syntax error when missing template-ending in go source.
![Custom](./assets/screenshots/custom.png)

### 0.0.2 (2020-12-09)
## Known Issues

- Support syntax highlighting for Go Template embedded in literal string in Go source file.
- Support syntax highlighting for Go Template files: `*.gtpl`.
1. This extension cannot bypass grammar check error from Language Server.
1. Template syntax highlighting in some languages may need to reload extension. (<kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>P</kbd> `go-template.reload`)

### 0.0.1 (2020-09-09)
## Release Notes

- Support syntax highlighting for Go Template files: `*.go.txt`, `*.go.tpl`, `*.go.tmpl`.
- Support syntax highlighting for Go Template embedded in `HTML`, `JS`, and `CSS` files.
- Support syntax highlighting for Go Template embedded in unknown extension files which begin with `{{ /* Go Template */ }}`.
[Change Log](./CHANGELOG.md)
Binary file added assets/screenshots/custom.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit b9e6d53

Please sign in to comment.