Compare commits

..

No commits in common. "aa92d04ed43b23e7bb4ff5875146dc9460169c68" and "c0272d88f8075523d1816da306103736b36a9c4c" have entirely different histories.

13 changed files with 98 additions and 2742 deletions

View File

@ -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
View File

@ -1 +0,0 @@
*.xcf filter=lfs diff=lfs merge=lfs -text

View File

@ -8,50 +8,49 @@ Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how
### 0.0.1
- Initial release with syntax highlighting.
Initial release with syntax highlighting.
### 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
- Fixed image in README to reflect new features.
Fixed image in README to reflect new features.
### 0.2.3
- Tidy README and clean up `devDependencies`.
Tidy README and clean up `devDependencies`.
### 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
- Add icon to marketplace.
Add icon to marketplace.
### 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
- Set banner background to Monokai dark background.
Set banner background to Monokai dark background.
### 0.2.8
- Use default banner background.
Use default banner background.
### 0.2.9
- Add badges to README
Add badges to README
## [1.0.0] - 2019-12-02
- Tidy README
- 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).
- Use more recent version of libraries to avoid security vulnerability found by GitHub's dependabot.

View File

@ -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`.
_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
@ -19,32 +19,14 @@ _Alternatively_, the extension can be built and installed manually as in the nex
npm install
```
3. Compile with `npm`
```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`
3. Create a package using `vsce`
```bash
vsce package
```
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
code --install-extension swmf-grammar-?.?.?.vsix

View File

@ -1,5 +1,5 @@
#ECHO
Highlighting demo using dark theme.
Highlighting demo using Monokai dark theme.
#BEGIN_COMP SC Marker with folding button in margin

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:96f1e9c2ba8b74a9fdb75bb1b486a54d1d8a1e079054f1b1f4813e962eb64cb3
size 14180

2508
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,73 +1,58 @@
{
"name": "swmf-grammar",
"displayName": "SWMF Configuration",
"description": "Syntax highlights and outline view for SWMF configuration files",
"version": "1.0.1",
"publisher": "svaberg",
"repository": {
"type": "git",
"url": "https://github.com/svaberg/SWMF-grammar.git"
},
"license": "MIT",
"engines": {
"vscode": "^1.74.0"
},
"categories": [
"Programming Languages",
"Formatters"
],
"activationEvents": [
"onLanguage:swmf-config"
],
"icon": "images/icon.png",
"main": "./out/extension.js",
"contributes": {
"languages": [
{
"id": "swmf-config",
"aliases": [
"SWMF Config",
"swmf"
],
"extensions": [
".in",
".IN"
],
"configuration": "./language-configuration.json"
}
"name": "swmf-grammar",
"displayName": "SWMF Configuration",
"description": "Syntax highlights and outline view for SWMF configuration files",
"version": "1.0.0",
"publisher": "svaberg",
"repository": {
"type": "git",
"url": "https://github.com/svaberg/SWMF-grammar"
},
"license": "MIT",
"engines": {
"vscode": "^1.41.0"
},
"categories": [
"Programming Languages",
"Formatters"
],
"grammars": [
{
"language": "swmf-config",
"scopeName": "source.swmf",
"path": "./syntaxes/swmf.tmLanguage.json"
}
]
},
"scripts": {
"vscode:prepublish": "npm run compile",
"compile": "tsc -p ./",
"watch": "tsc -watch -p ./",
"pretest": "npm run compile && npm run lint",
"lint": "eslint src --ext ts",
"test": "node ./out/test/runTest.js"
},
"devDependencies": {
"@types/glob": "^8.0.0",
"@types/mocha": "^10.0.1",
"@types/node": "16.x",
"@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"
"icon": "images/icon.png",
"main": "./out/extension.js",
"activationEvents": [
"onLanguage:swmf-config"
],
"contributes": {
"languages": [
{
"id": "swmf-config",
"aliases": [
"SWMF Config",
"swmf"
],
"extensions": [
".in",
".IN"
],
"configuration": "./language-configuration.json"
}
],
"grammars": [
{
"language": "swmf-config",
"scopeName": "source.swmf",
"path": "./syntaxes/swmf.tmLanguage.json"
}
]
},
"scripts": {
"vscode:prepublish": "npm run compile",
"compile": "tsc -p ./",
"watch": "tsc -watch -p ./",
"pretest": "npm run compile"
},
"devDependencies": {
"typescript": "^3.7.5",
"vscode-test": "^1.3.0",
"@types/vscode": "^1.41.0"
}
}

View File

@ -26,24 +26,24 @@ class SwmfConfigDocumentSymbolProvider implements vscode.DocumentSymbolProvider
{
return new Promise((resolve, reject) =>
{
const symbols: vscode.DocumentSymbol[] = [];
const nodes = [symbols]
let symbols: vscode.DocumentSymbol[] = [];
let nodes = [symbols]
let inside_marker = false
let inside_run = false
let inside_userinput = false
const symbolkind_marker = vscode.SymbolKind.Field
const symbolkind_run = vscode.SymbolKind.Event
const symbolkind_cmd = vscode.SymbolKind.Function
let symbolkind_marker = vscode.SymbolKind.Field
let symbolkind_run = vscode.SymbolKind.Event
let symbolkind_cmd = vscode.SymbolKind.Function
for (let i = 0; i < document.lineCount; i++) {
const line = document.lineAt(i);
for (var i = 0; i < document.lineCount; i++) {
var line = document.lineAt(i);
const tokens = line.text.split(" ")
let tokens = line.text.split(" ")
if (line.text.startsWith("#BEGIN_COMP")) {
const marker_symbol = new vscode.DocumentSymbol(
let marker_symbol = new vscode.DocumentSymbol(
this.format(tokens[0]) + " " + tokens[1],
'Component',
symbolkind_marker,
@ -66,7 +66,7 @@ class SwmfConfigDocumentSymbolProvider implements vscode.DocumentSymbolProvider
}
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]),
'Session separator',
symbolkind_run,
@ -82,7 +82,7 @@ class SwmfConfigDocumentSymbolProvider implements vscode.DocumentSymbolProvider
}
else if (line.text.startsWith("#USERINPUTBEGIN")) {
const user_symbol = new vscode.DocumentSymbol(
let user_symbol = new vscode.DocumentSymbol(
this.format(tokens[0]),
'User module',
vscode.SymbolKind.Interface,
@ -104,7 +104,7 @@ class SwmfConfigDocumentSymbolProvider implements vscode.DocumentSymbolProvider
}
}
else if (line.text.startsWith("#")) {
const cmd_symbol = new vscode.DocumentSymbol(
let cmd_symbol = new vscode.DocumentSymbol(
this.format(tokens[0]),
'',
symbolkind_cmd,

View File

@ -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();

View File

@ -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));
});
});

View File

@ -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);
}
});
});
}

View File

@ -1,17 +1,16 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "ES2020",
"outDir": "out",
"lib": [
"ES2020"
],
"sourceMap": true,
"rootDir": "src",
"strict": true /* enable all strict type-checking options */
/* Additional Checks */
// "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */
// "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */
// "noUnusedParameters": true, /* Report errors on unused parameters. */
}
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"outDir": "out",
"lib": [
"es6"
],
"sourceMap": true,
"rootDir": "src"
},
"exclude": [
"node_modules",
".vscode-test"
]
}