Compare commits
No commits in common. "aa92d04ed43b23e7bb4ff5875146dc9460169c68" and "c0272d88f8075523d1816da306103736b36a9c4c" have entirely different histories.
aa92d04ed4
...
c0272d88f8
|
@ -1,21 +0,0 @@
|
||||||
{
|
|
||||||
"env": {
|
|
||||||
"browser": true,
|
|
||||||
"es2021": true
|
|
||||||
},
|
|
||||||
"extends": [
|
|
||||||
"eslint:recommended",
|
|
||||||
"plugin:@typescript-eslint/recommended"
|
|
||||||
],
|
|
||||||
"overrides": [
|
|
||||||
],
|
|
||||||
"parser": "@typescript-eslint/parser",
|
|
||||||
"parserOptions": {
|
|
||||||
"ecmaVersion": "latest"
|
|
||||||
},
|
|
||||||
"plugins": [
|
|
||||||
"@typescript-eslint"
|
|
||||||
],
|
|
||||||
"rules": {
|
|
||||||
}
|
|
||||||
}
|
|
1
.gitattributes
vendored
1
.gitattributes
vendored
|
@ -1 +0,0 @@
|
||||||
*.xcf filter=lfs diff=lfs merge=lfs -text
|
|
23
CHANGELOG.md
23
CHANGELOG.md
|
@ -8,50 +8,49 @@ Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how
|
||||||
|
|
||||||
### 0.0.1
|
### 0.0.1
|
||||||
|
|
||||||
- Initial release with syntax highlighting.
|
Initial release with syntax highlighting.
|
||||||
|
|
||||||
### 0.2.0
|
### 0.2.0
|
||||||
|
|
||||||
- Added hierarchical [outline view](https://code.visualstudio.com/docs/getstarted/userinterface#_outline-view).
|
Added hierarchical [outline view](https://code.visualstudio.com/docs/getstarted/userinterface#_outline-view).
|
||||||
|
|
||||||
### 0.2.2
|
### 0.2.2
|
||||||
|
|
||||||
- Fixed image in README to reflect new features.
|
Fixed image in README to reflect new features.
|
||||||
|
|
||||||
### 0.2.3
|
### 0.2.3
|
||||||
|
|
||||||
- Tidy README and clean up `devDependencies`.
|
Tidy README and clean up `devDependencies`.
|
||||||
|
|
||||||
### 0.2.4
|
### 0.2.4
|
||||||
|
|
||||||
- Mention support for [Breadcrumbs](https://code.visualstudio.com/updates/v1_26#_breadcrumbs).
|
Mention support for [Breadcrumbs](https://code.visualstudio.com/updates/v1_26#_breadcrumbs).
|
||||||
|
|
||||||
### 0.2.5
|
### 0.2.5
|
||||||
|
|
||||||
- Add icon to marketplace.
|
Add icon to marketplace.
|
||||||
|
|
||||||
### 0.2.6
|
### 0.2.6
|
||||||
|
|
||||||
- Move manual installation instructions to [INSTALL.md](INSTALL.md). Add transparent icon borders.
|
Move manual installation instructions to [INSTALL.md](INSTALL.md). Add transparent icon borders.
|
||||||
|
|
||||||
### 0.2.7
|
### 0.2.7
|
||||||
|
|
||||||
- Set banner background to Monokai dark background.
|
Set banner background to Monokai dark background.
|
||||||
|
|
||||||
### 0.2.8
|
### 0.2.8
|
||||||
|
|
||||||
- Use default banner background.
|
Use default banner background.
|
||||||
|
|
||||||
### 0.2.9
|
### 0.2.9
|
||||||
|
|
||||||
- Add badges to README
|
Add badges to README
|
||||||
|
|
||||||
## [1.0.0] - 2019-12-02
|
## [1.0.0] - 2019-12-02
|
||||||
|
|
||||||
- Tidy README
|
- Tidy README
|
||||||
- Add license badge
|
- Add license badge
|
||||||
|
|
||||||
## [1.0.1] - 2021-01-19
|
## Not yet released
|
||||||
|
|
||||||
- Migrate from `vscode` to `vscode-test` [as described on the VS Code site](https://code.visualstudio.com/api/working-with-extensions/testing-extension#migrating-from-vscode).
|
- Migrate from `vscode` to `vscode-test` [as described on the VS Code site](https://code.visualstudio.com/api/working-with-extensions/testing-extension#migrating-from-vscode).
|
||||||
- Use more recent version of libraries to avoid security vulnerability found by GitHub's dependabot.
|
|
||||||
|
|
26
INSTALL.md
26
INSTALL.md
|
@ -1,10 +1,10 @@
|
||||||
# Manual installation
|
# Installation
|
||||||
|
|
||||||
>This is a [Visual Studio Code](https://code.visualstudio.com/download) extension. It is best installed from the [on-line extensions marketplace](https://marketplace.visualstudio.com/items?itemName=svaberg.swmf-grammar), or from inside VS Code `Preferences/Extensions` and search for `swmf-grammar`.
|
>This is a [Visual Studio Code](https://code.visualstudio.com/download) extension. It is best installed from the [on-line extensions marketplace](https://marketplace.visualstudio.com/items?itemName=svaberg.swmf-grammar), or from inside VS Code `Preferences/Extensions` and search for `swmf-grammar`.
|
||||||
|
|
||||||
_Alternatively_, the extension can be built and installed manually as in the next section. This should only be required for developers.
|
_Alternatively_, the extension can be built and installed manually as in the next section. This should only be required for developers.
|
||||||
|
|
||||||
## Build the extension
|
## Manual installation from source code
|
||||||
|
|
||||||
1. Clone the repository and enter into the folder
|
1. Clone the repository and enter into the folder
|
||||||
|
|
||||||
|
@ -19,32 +19,14 @@ _Alternatively_, the extension can be built and installed manually as in the nex
|
||||||
npm install
|
npm install
|
||||||
```
|
```
|
||||||
|
|
||||||
3. Compile with `npm`
|
3. Create a package using `vsce`
|
||||||
|
|
||||||
```bash
|
|
||||||
npm run compile
|
|
||||||
```
|
|
||||||
|
|
||||||
At this point the extension may be debugged in the Extension Development Host:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
code .
|
|
||||||
```
|
|
||||||
|
|
||||||
followed by the `Run/Start Debugging` dropdown (or the `F5` key). To observe the extension in action, view the file `demo.in`.
|
|
||||||
|
|
||||||
To complete the manual installation, follow the remaining steps to manually create and install the package:
|
|
||||||
|
|
||||||
## Package and install the extension
|
|
||||||
|
|
||||||
4. Create a package using `vsce`
|
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
vsce package
|
vsce package
|
||||||
```
|
```
|
||||||
|
|
||||||
This should generate a `swmf-grammar-?.?.?.vsix` file in the current directory.
|
This should generate a `swmf-grammar-?.?.?.vsix` file in the current directory.
|
||||||
5. Manually install the extension in VS Code (you may want to replace the wildcards in the version number)
|
4. Manually install the extension in VS Code (you may want to replace the wildcards in the version number)
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
code --install-extension swmf-grammar-?.?.?.vsix
|
code --install-extension swmf-grammar-?.?.?.vsix
|
||||||
|
|
2
demo.in
2
demo.in
|
@ -1,5 +1,5 @@
|
||||||
#ECHO
|
#ECHO
|
||||||
Highlighting demo using dark theme.
|
Highlighting demo using Monokai dark theme.
|
||||||
|
|
||||||
#BEGIN_COMP SC Marker with folding button in margin
|
#BEGIN_COMP SC Marker with folding button in margin
|
||||||
|
|
||||||
|
|
|
@ -1,3 +0,0 @@
|
||||||
version https://git-lfs.github.com/spec/v1
|
|
||||||
oid sha256:96f1e9c2ba8b74a9fdb75bb1b486a54d1d8a1e079054f1b1f4813e962eb64cb3
|
|
||||||
size 14180
|
|
2508
package-lock.json
generated
2508
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
35
package.json
35
package.json
|
@ -2,25 +2,25 @@
|
||||||
"name": "swmf-grammar",
|
"name": "swmf-grammar",
|
||||||
"displayName": "SWMF Configuration",
|
"displayName": "SWMF Configuration",
|
||||||
"description": "Syntax highlights and outline view for SWMF configuration files",
|
"description": "Syntax highlights and outline view for SWMF configuration files",
|
||||||
"version": "1.0.1",
|
"version": "1.0.0",
|
||||||
"publisher": "svaberg",
|
"publisher": "svaberg",
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/svaberg/SWMF-grammar.git"
|
"url": "https://github.com/svaberg/SWMF-grammar"
|
||||||
},
|
},
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"engines": {
|
"engines": {
|
||||||
"vscode": "^1.74.0"
|
"vscode": "^1.41.0"
|
||||||
},
|
},
|
||||||
"categories": [
|
"categories": [
|
||||||
"Programming Languages",
|
"Programming Languages",
|
||||||
"Formatters"
|
"Formatters"
|
||||||
],
|
],
|
||||||
|
"icon": "images/icon.png",
|
||||||
|
"main": "./out/extension.js",
|
||||||
"activationEvents": [
|
"activationEvents": [
|
||||||
"onLanguage:swmf-config"
|
"onLanguage:swmf-config"
|
||||||
],
|
],
|
||||||
"icon": "images/icon.png",
|
|
||||||
"main": "./out/extension.js",
|
|
||||||
"contributes": {
|
"contributes": {
|
||||||
"languages": [
|
"languages": [
|
||||||
{
|
{
|
||||||
|
@ -48,26 +48,11 @@
|
||||||
"vscode:prepublish": "npm run compile",
|
"vscode:prepublish": "npm run compile",
|
||||||
"compile": "tsc -p ./",
|
"compile": "tsc -p ./",
|
||||||
"watch": "tsc -watch -p ./",
|
"watch": "tsc -watch -p ./",
|
||||||
"pretest": "npm run compile && npm run lint",
|
"pretest": "npm run compile"
|
||||||
"lint": "eslint src --ext ts",
|
|
||||||
"test": "node ./out/test/runTest.js"
|
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/glob": "^8.0.0",
|
"typescript": "^3.7.5",
|
||||||
"@types/mocha": "^10.0.1",
|
"vscode-test": "^1.3.0",
|
||||||
"@types/node": "16.x",
|
"@types/vscode": "^1.41.0"
|
||||||
"@types/vscode": "^1.74.0",
|
}
|
||||||
"@typescript-eslint/eslint-plugin": "^5.48.2",
|
|
||||||
"@typescript-eslint/parser": "^5.48.2",
|
|
||||||
"@vscode/test-electron": "^2.2.0",
|
|
||||||
"eslint": "^8.28.0",
|
|
||||||
"glob": "^8.0.3",
|
|
||||||
"mocha": "^10.1.0",
|
|
||||||
"typescript": "^4.9.3"
|
|
||||||
},
|
|
||||||
"bugs": {
|
|
||||||
"url": "https://github.com/svaberg/SWMF-grammar/issues"
|
|
||||||
},
|
|
||||||
"homepage": "https://github.com/svaberg/SWMF-grammar#readme",
|
|
||||||
"author": "Dag Evensberget"
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,24 +26,24 @@ class SwmfConfigDocumentSymbolProvider implements vscode.DocumentSymbolProvider
|
||||||
{
|
{
|
||||||
return new Promise((resolve, reject) =>
|
return new Promise((resolve, reject) =>
|
||||||
{
|
{
|
||||||
const symbols: vscode.DocumentSymbol[] = [];
|
let symbols: vscode.DocumentSymbol[] = [];
|
||||||
const nodes = [symbols]
|
let nodes = [symbols]
|
||||||
let inside_marker = false
|
let inside_marker = false
|
||||||
let inside_run = false
|
let inside_run = false
|
||||||
let inside_userinput = false
|
let inside_userinput = false
|
||||||
|
|
||||||
const symbolkind_marker = vscode.SymbolKind.Field
|
let symbolkind_marker = vscode.SymbolKind.Field
|
||||||
const symbolkind_run = vscode.SymbolKind.Event
|
let symbolkind_run = vscode.SymbolKind.Event
|
||||||
const symbolkind_cmd = vscode.SymbolKind.Function
|
let symbolkind_cmd = vscode.SymbolKind.Function
|
||||||
|
|
||||||
for (let i = 0; i < document.lineCount; i++) {
|
for (var i = 0; i < document.lineCount; i++) {
|
||||||
const line = document.lineAt(i);
|
var line = document.lineAt(i);
|
||||||
|
|
||||||
const tokens = line.text.split(" ")
|
let tokens = line.text.split(" ")
|
||||||
|
|
||||||
if (line.text.startsWith("#BEGIN_COMP")) {
|
if (line.text.startsWith("#BEGIN_COMP")) {
|
||||||
|
|
||||||
const marker_symbol = new vscode.DocumentSymbol(
|
let marker_symbol = new vscode.DocumentSymbol(
|
||||||
this.format(tokens[0]) + " " + tokens[1],
|
this.format(tokens[0]) + " " + tokens[1],
|
||||||
'Component',
|
'Component',
|
||||||
symbolkind_marker,
|
symbolkind_marker,
|
||||||
|
@ -66,7 +66,7 @@ class SwmfConfigDocumentSymbolProvider implements vscode.DocumentSymbolProvider
|
||||||
}
|
}
|
||||||
else if (line.text.startsWith("#RUN") || line.text.startsWith("#END")) {
|
else if (line.text.startsWith("#RUN") || line.text.startsWith("#END")) {
|
||||||
|
|
||||||
const run_symbol = new vscode.DocumentSymbol(
|
let run_symbol = new vscode.DocumentSymbol(
|
||||||
this.format(tokens[0]),
|
this.format(tokens[0]),
|
||||||
'Session separator',
|
'Session separator',
|
||||||
symbolkind_run,
|
symbolkind_run,
|
||||||
|
@ -82,7 +82,7 @@ class SwmfConfigDocumentSymbolProvider implements vscode.DocumentSymbolProvider
|
||||||
}
|
}
|
||||||
else if (line.text.startsWith("#USERINPUTBEGIN")) {
|
else if (line.text.startsWith("#USERINPUTBEGIN")) {
|
||||||
|
|
||||||
const user_symbol = new vscode.DocumentSymbol(
|
let user_symbol = new vscode.DocumentSymbol(
|
||||||
this.format(tokens[0]),
|
this.format(tokens[0]),
|
||||||
'User module',
|
'User module',
|
||||||
vscode.SymbolKind.Interface,
|
vscode.SymbolKind.Interface,
|
||||||
|
@ -104,7 +104,7 @@ class SwmfConfigDocumentSymbolProvider implements vscode.DocumentSymbolProvider
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (line.text.startsWith("#")) {
|
else if (line.text.startsWith("#")) {
|
||||||
const cmd_symbol = new vscode.DocumentSymbol(
|
let cmd_symbol = new vscode.DocumentSymbol(
|
||||||
this.format(tokens[0]),
|
this.format(tokens[0]),
|
||||||
'',
|
'',
|
||||||
symbolkind_cmd,
|
symbolkind_cmd,
|
||||||
|
|
|
@ -1,23 +0,0 @@
|
||||||
import * as path from 'path';
|
|
||||||
|
|
||||||
import { runTests } from '@vscode/test-electron';
|
|
||||||
|
|
||||||
async function main() {
|
|
||||||
try {
|
|
||||||
// The folder containing the Extension Manifest package.json
|
|
||||||
// Passed to `--extensionDevelopmentPath`
|
|
||||||
const extensionDevelopmentPath = path.resolve(__dirname, '../../');
|
|
||||||
|
|
||||||
// The path to test runner
|
|
||||||
// Passed to --extensionTestsPath
|
|
||||||
const extensionTestsPath = path.resolve(__dirname, './suite/index');
|
|
||||||
|
|
||||||
// Download VS Code, unzip it and run the integration test
|
|
||||||
await runTests({ extensionDevelopmentPath, extensionTestsPath });
|
|
||||||
} catch (err) {
|
|
||||||
console.error('Failed to run tests');
|
|
||||||
process.exit(1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
main();
|
|
|
@ -1,15 +0,0 @@
|
||||||
import * as assert from 'assert';
|
|
||||||
|
|
||||||
// You can import and use all API from the 'vscode' module
|
|
||||||
// as well as import your extension to test it
|
|
||||||
import * as vscode from 'vscode';
|
|
||||||
// import * as myExtension from '../../extension';
|
|
||||||
|
|
||||||
suite('Extension Test Suite', () => {
|
|
||||||
vscode.window.showInformationMessage('Start all tests.');
|
|
||||||
|
|
||||||
test('Sample test', () => {
|
|
||||||
assert.strictEqual(-1, [1, 2, 3].indexOf(5));
|
|
||||||
assert.strictEqual(-1, [1, 2, 3].indexOf(0));
|
|
||||||
});
|
|
||||||
});
|
|
|
@ -1,38 +0,0 @@
|
||||||
import * as path from 'path';
|
|
||||||
import * as Mocha from 'mocha';
|
|
||||||
import * as glob from 'glob';
|
|
||||||
|
|
||||||
export function run(): Promise<void> {
|
|
||||||
// Create the mocha test
|
|
||||||
const mocha = new Mocha({
|
|
||||||
ui: 'tdd',
|
|
||||||
color: true
|
|
||||||
});
|
|
||||||
|
|
||||||
const testsRoot = path.resolve(__dirname, '..');
|
|
||||||
|
|
||||||
return new Promise((c, e) => {
|
|
||||||
glob('**/**.test.js', { cwd: testsRoot }, (err, files) => {
|
|
||||||
if (err) {
|
|
||||||
return e(err);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Add files to the test suite
|
|
||||||
files.forEach(f => mocha.addFile(path.resolve(testsRoot, f)));
|
|
||||||
|
|
||||||
try {
|
|
||||||
// Run the mocha test
|
|
||||||
mocha.run(failures => {
|
|
||||||
if (failures > 0) {
|
|
||||||
e(new Error(`${failures} tests failed.`));
|
|
||||||
} else {
|
|
||||||
c();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} catch (err) {
|
|
||||||
console.error(err);
|
|
||||||
e(err);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
|
@ -1,17 +1,16 @@
|
||||||
{
|
{
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"module": "commonjs",
|
"module": "commonjs",
|
||||||
"target": "ES2020",
|
"target": "es6",
|
||||||
"outDir": "out",
|
"outDir": "out",
|
||||||
"lib": [
|
"lib": [
|
||||||
"ES2020"
|
"es6"
|
||||||
],
|
],
|
||||||
"sourceMap": true,
|
"sourceMap": true,
|
||||||
"rootDir": "src",
|
"rootDir": "src"
|
||||||
"strict": true /* enable all strict type-checking options */
|
},
|
||||||
/* Additional Checks */
|
"exclude": [
|
||||||
// "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */
|
"node_modules",
|
||||||
// "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */
|
".vscode-test"
|
||||||
// "noUnusedParameters": true, /* Report errors on unused parameters. */
|
]
|
||||||
}
|
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user