Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
71 commits
Select commit Hold shift + click to select a range
bd2ee0b
updated README
lharri73 Feb 6, 2021
2f050a0
added dbc preview button
lharri73 Feb 6, 2021
3bd770a
removed codeql analysis...
lharri73 Feb 6, 2021
b751347
added message passing
lharri73 Feb 6, 2021
3608abf
restructure
lharri73 Feb 6, 2021
31d1c51
added overlay to preview icon
lharri73 Feb 7, 2021
9b38aa0
moved icons back to center
lharri73 Feb 7, 2021
f94be58
working on adding to preview
lharri73 Feb 7, 2021
56b6cca
removed tsbuildinfo
lharri73 Feb 7, 2021
4fca945
issues parsing message object back to message class
lharri73 Feb 8, 2021
c5b4eca
fixed serialization and deserialization issue
lharri73 Feb 20, 2021
f4a6ecf
working on message panel
lharri73 Feb 20, 2021
fecb407
changed JSON parse option
lharri73 Feb 20, 2021
db6e3bd
start angular stuff
lharri73 Feb 20, 2021
40e5251
changed client to angular app
lharri73 Feb 21, 2021
13cfa76
Merge pull request #13 from lharri73/angular
lharri73 Feb 21, 2021
e8d8b41
cleaning up angular mess
lharri73 Feb 28, 2021
4328103
removed old client code
lharri73 Feb 28, 2021
753357f
fixed name of window
lharri73 Mar 1, 2021
a84c48e
working iterator over all messages
lharri73 Mar 1, 2021
a56ea16
changed when preview is available
lharri73 Mar 17, 2021
70be61d
added basic message component
lharri73 Mar 17, 2021
6c7ab85
got webpack working
lharri73 Apr 11, 2021
eb50eb6
fixing compiling issues
lharri73 Apr 14, 2021
4396ba0
fixed string length error
lharri73 Apr 21, 2021
9ad33ed
debuggging crash
lharri73 Apr 22, 2021
0e53d47
Bump lodash from 4.17.20 to 4.17.21
dependabot[bot] May 11, 2021
4b42583
fixed respawn issue
lharri73 May 12, 2021
c70faff
fixing notification passing
lharri73 May 23, 2021
37acb4e
starting refactor
lharri73 May 25, 2021
8855eee
Revert "starting refactor"
lharri73 May 28, 2021
845468d
working with custom editor
lharri73 May 29, 2021
fb327e2
fixed initialize problem...replaced with new issue
lharri73 Jun 1, 2021
e161b3c
renamed src file
lharri73 Jun 1, 2021
6a2f5b6
fixed initialize problem
lharri73 Jun 1, 2021
1408ea8
updated dbclib path
lharri73 Jun 1, 2021
5c8b193
re-enable CI
lharri73 Jun 1, 2021
a64b61d
fixed webview and custom editor
lharri73 Jun 2, 2021
148ba02
working on encoders
lharri73 Jun 2, 2021
019d050
fixed encode/decode...much faster
lharri73 Jun 3, 2021
b0aefe4
dbclib code cleanup
lharri73 Jun 4, 2021
724bba9
broke button opening...
lharri73 Jun 4, 2021
e08cb9b
remove all angular stuff...going with react
lharri73 Jun 23, 2021
30b4495
updated to react
lharri73 Jun 23, 2021
4fbcbcf
working on re-implementing old client code
lharri73 Jun 23, 2021
4631eae
fixed webview launcher
lharri73 Jul 5, 2021
e89db28
added condition to showing of panel
lharri73 Jul 24, 2021
0d09424
update webpack versions
lharri73 Feb 23, 2022
e700d99
minimize size of encoded dbc
lharri73 Mar 13, 2022
ecabd87
remove from editor list
lharri73 Mar 13, 2022
1f0ac60
making progress on displaying dbc
lharri73 Mar 13, 2022
93928c5
changed to lock when parsing
lharri73 Mar 13, 2022
2c80b8f
bump copyright
lharri73 Mar 13, 2022
af67095
faster response times
lharri73 Mar 13, 2022
4047529
displaying drop down for signals
lharri73 Mar 13, 2022
4ec1f5c
fixed dbclib encoding
lharri73 Mar 19, 2022
4b8c769
fixed dbclib...for real
lharri73 Mar 19, 2022
8ea0029
added messages
lharri73 May 26, 2022
8a1112e
added search
lharri73 May 26, 2022
4de9a3e
update readme
lharri73 May 26, 2022
ea74b33
Merge remote-tracking branch 'origin/dependabot/npm_and_yarn/lodash-4…
lharri73 May 26, 2022
74c1b74
update github recomendations
lharri73 May 26, 2022
6426ccf
working. need to fix dbclib in jison
lharri73 May 28, 2022
0623159
fixed relative path in jison file
lharri73 May 28, 2022
b48aee7
added vsce as dev dependency
lharri73 May 28, 2022
8ba346e
working on integration
lharri73 May 28, 2022
154186c
working on ci pt. 2
lharri73 May 28, 2022
04c0a38
remove fluff from ci
lharri73 May 28, 2022
2e16c9a
update changelog
lharri73 May 28, 2022
bddd215
change name of preview tab
lharri73 May 28, 2022
f5d45e2
Merge pull request #19 from lharri73/develop
lharri73 May 28, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
- run: npm install
name: install dependencies

- run: npm run compile
- run: npm run webpack
name: Compile verification

# Initializes the CodeQL tools for scanning.
Expand Down
30 changes: 5 additions & 25 deletions .github/workflows/integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,6 @@ on:
branches: [ master ]

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: configure
run: npm install
- name: make
run: make

compile:
runs-on: ubuntu-latest
strategy:
Expand All @@ -32,20 +23,9 @@ jobs:
with:
node-version: ${{matrix.node-version}}

- run: npm install
name: install dependencies
- run: npm install --also=dev
name: Install Dependencies

- run: npm run compile
name: Compile verification

## TODO: unit tests

# disabled because syntax not generated on master
# syntax_tests:
# name: Run Syntax Tests
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v2
# - uses: SublimeText/syntax-test-action@v2
# with:
# build: latest
- run: make
name: Compile and Build

3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,6 @@ client/out/*
!server/out/.keep
!client/out/.keep
.DS_Store
*.tsbuildinfo
dist
server/dist
20 changes: 2 additions & 18 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,31 +8,15 @@
"name": "Launch Client",
"runtimeExecutable": "${execPath}",
"args": ["--extensionDevelopmentPath=${workspaceRoot}"],
"outFiles": ["${workspaceRoot}/client/out/**/*.js"],
"preLaunchTask": {
"type": "npm",
"script": "compile"
}
"outFiles": ["${workspaceRoot}/client/out/**/*.js"]
},
{
"type": "node",
"request": "attach",
"name": "Attach to Server",
"port": 6009,
"restart": true,
"outFiles": ["${workspaceRoot}/server/out/**/*.js"]
},
{
"name": "Language Server E2E Test",
"type": "extensionHost",
"request": "launch",
"runtimeExecutable": "${execPath}",
"args": [
"--extensionDevelopmentPath=${workspaceRoot}",
"--extensionTestsPath=${workspaceRoot}/client/out/test/index",
"${workspaceRoot}/client/testFixture"
],
"outFiles": ["${workspaceRoot}/client/out/test/**/*.js"]
"outFiles": ["${workspaceRoot}/server/dist/*.js"]
}
],
"compounds": [
Expand Down
2 changes: 1 addition & 1 deletion .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@
"isBackground": true
}
]
}
}
26 changes: 23 additions & 3 deletions .vscodeignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,29 @@
.vscode/**
.vscode-test/**
.gitignore
.github
src
res/image.xcf
node_modules
server/node_modules
client/node_modules
.DS_Store
node_modules

server/**
!server/out
!server/dist
!server/dbc.*
!server/package.json
!server/package-lock.json

client/**
!client/dist
!client/build
!client/package.json
!client/package-lock.json

dbcLib/**
!dbcLib/dist
!dbcLib/build

changelog.md
Makefile
syntaxSrc
49 changes: 45 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (C) 2021 Landon Harris
# Copyright (C) 2022 Landon Harris

# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
Expand All @@ -13,9 +13,50 @@
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
all: src/dbcLang.yml
npx js-yaml src/dbcLang.yml > syntaxes/dbc.tmLanguage.json
npx js-yaml src/snippets.yml > snippets/snippets.json
SHELL := /bin/bash

dbclib := dbcLib/dist/index.js
client := client/build/ext-src/serverPack.js
server := server/dist/serverPack.js

all: syntaxes $(dbclib) $(client) $(server)
client: $(client)
server: $(server)
dbclib: $(dbclib)

$(dbclib): $(wildcard dbcLib/*.ts) $(wildcard dbcLib/dbc/*.ts)
cd dbcLib && tsc && webpack --mode production
rm -rf ./{client,server}/dbcLib
mkdir -p client/dbcLib server/dbcLib
# cp -r dbcLib/{dist,build,package.json,package-lock.json,node_modules} client/src/dbcLib/
# cp -r dbcLib/{dist,build,package.json,package-lock.json,node_modules} server/dbcLib/

$(client): $(dbclib) $(wildcard client/ext-src/*.ts) $(wildcard client/public/*) $(wildcard client/scripts/*.js) $(wildcard client/src/*)
cd client && npm run build
# cp client/dist/* client/build/ext-src/

$(server): $(dbclib) $(wildcard server/src/*.ts) server/dbc.jison server/dbc.lex
cd server && npm run build


.PHONY: syntaxes
syntaxes: syntaxes/dbc.tmLanguage.json snippets/snippets.json

syntaxes/dbc.tmLanguage.json: syntaxSrc/dbcLang.yml
npx js-yaml syntaxSrc/dbcLang.yml > syntaxes/dbc.tmLanguage.json

snippets/snippets.json: syntaxSrc/snippets.yml
npx js-yaml syntaxSrc/snippets.yml > snippets/snippets.json

.PHONY: clean
clean:
rm -f syntaxes/dbc.tmLanguage.json snippets/snippets.json
rm -rf client/build client/dist
rm -rf dbcLib/build dbcLib/dist
rm -rf server/dist server/out
rm *.vsix
# rm -rf {client,server}/dbcLib

.PHONY: package
package: $(dbclib) $(client) $(server) syntaxes
vsce package
60 changes: 33 additions & 27 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
![Visual Studio Marketplace Version](https://img.shields.io/visual-studio-marketplace/v/lharri73.dbc?style=flat-square)
![GitHub Workflow Status](https://img.shields.io/github/workflow/status/lharri73/DBC-Language-Syntax/DBC%20language%20CI?style=flat-square)

This extension provides basic syntax highlighting, bracket completion, code snippets
and lexer/parser errors for the Vector DBC file format.
This extension provides basic syntax highlighting, bracket completion, code
snippets, lexer/parser errors, and a preview window for the Vector DBC file format.
This is created to work with version 2 of the [Vector DBC file format](https://bitbucket.org/tobylorenz/vector_dbc/src/master/).

Although DBC files are often programmatically generated, it can be useful to
Expand All @@ -13,47 +13,53 @@ Syntax highlighting is handled locally through VSCode's
integrated TextMates language parsing engine, using PCRE regular
expressions to match syntax.

This extension also provides a sidebar to preview messages in the current, open
DBC file. While this doesn't allow editing, it takes information from various
parts of the DBC and makes it easily readable and searchable.

*The preview window is still a work in progress!*

## Syntax Highlighting
<img src="res/syntax.png" width="500">

## Message and Signal Preview
<img src="res/sidebar.gif" width="800">

## Lexicographic and Parser Errors
<img src="res/errors.gif" width="800">

## Commonly Used Snippets
<img src="res/snippets.gif" width="800">

## Supported keywords
- BA
- BA_DEF
- BA_DEF_DEF
- BA_DEF_DEF_REL
- BA_DEF_REL
- BA_REL
- BO
- BO_TX_BU
- BS
- BU
- BU_SG_REL
- CM
- EV
- NS
- SG
- SGTYPE
- SIG_GROUP
- VAL
- VAL_TABLE
- VERSION
## Known Issues

1. Attribute definitions that wrap lines may not be highlighted on the following
lines.
1. Signals that are multiplexed will not be recognized

## Todo items
- Make lexer and parser errors more useful
- Add checks that prevent crashing when signals don't exist
- Include debugging (invalid offset, start bit, min, max, etc)
- Hover box to show all related fields as a hint
- Show more information about each signal (val tables, comments, etc.)
- Show the byte structure of the message

## Organization
- `server`
- Contains the language server and parser for the dbc language sytax
- `client`
- Contains the editor and viewer
- `dbcLib`
- basic type descriptions of each element/class of the dbc language

## 3rd Party Libraries
- [Vector DBC file format](https://bitbucket.org/tobylorenz/vector_dbc/src/master/).
- Although no code from this repository is used in this extension, this served
as a reference for the DBC format and syntax.
- [jison](https://github.com/zaach/jison)
- The parser and lexer used on the server side to parse dbc files
- [React.js](https://reactjs.org/)
- Used to display the parsed message/signal data in the vscode browser panel.
- [MessagePack](https://msgpack.org/)
- Serializes the parsed DBC file's intermediate representation into a packed
binary before sending to the browser panel.

## License
GNU General Public License v2.0 only
6 changes: 6 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,9 @@
# 1.2.3
- Fixed crashing issue that prevented parsing
- Added option to silence warnings from undefined objects

# 2.0.0
- Restructure of entire extension
- Added DBCLib to contain all components of dbc file
- Separated client and server code
- Added react-based side window that shows basic preview of messages & signals
1 change: 1 addition & 0 deletions client/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
PUBLIC_URL=./
2 changes: 2 additions & 0 deletions client/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules/
build/
41 changes: 31 additions & 10 deletions client/src/extension.ts → client/ext-src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,15 @@
*/

import * as path from 'path';
import { workspace, ExtensionContext } from 'vscode'
import { LanguageClient, LanguageClientOptions, ServerOptions, TransportKind } from 'vscode-languageclient';
import * as vscode from 'vscode';
import { DidChangeWorkspaceFoldersNotification, LanguageClient, LanguageClientOptions, ServerOptions, TransportKind } from 'vscode-languageclient/node';
import DBCPanel from './panel';

let client: LanguageClient;

export function activate(context: ExtensionContext){
let serverModule = context.asAbsolutePath(path.join('server', 'out', 'index.js'));

export function activate(context: vscode.ExtensionContext){
let serverModule = context.asAbsolutePath(path.join('server', 'dist', 'serverPack.js'));
let debugOptions = {execArgv: ['--nolazy', '--inspect=6009']}; //runs in node's inspector mode so vscode can attach for debugging

let serverOptions: ServerOptions = {
run: {
module: serverModule,
Expand All @@ -39,6 +38,10 @@ export function activate(context: ExtensionContext){

let clientOptions: LanguageClientOptions = {
documentSelector: [{scheme: 'file', language: 'dbc'}],
synchronize: {
// Notify the server about file changes to '.dbc files contained in the vscode.workspace
fileEvents: vscode.workspace.createFileSystemWatcher('**/.dbc')
}
};

client = new LanguageClient(
Expand All @@ -47,13 +50,31 @@ export function activate(context: ExtensionContext){
serverOptions,
clientOptions
);

// bind the callback function
// client.onReady().then(()=> {
// });

client.start();
vscode.commands.executeCommand('setContext', 'dbcLangSyntax.clientActive', true);

var {a: registration, b: panel} = DBCPanel.register(context,client);
context.subscriptions.push(registration);
// register showPreview command for button
context.subscriptions.push(
vscode.commands.registerCommand('dbc.showPreview', ()=>{
if(!vscode.window.activeTextEditor) return;
if(!panel.panel){
vscode.workspace.openTextDocument(vscode.window.activeTextEditor.document.uri).then(doc => {
const viewPanel = vscode.window.createWebviewPanel("dbc", "DBC Preview", {preserveFocus: true, viewColumn: vscode.ViewColumn.Beside});
panel.resolveCustomTextEditor(doc, viewPanel, <vscode.CancellationToken><unknown>null);
});
}
})
);
}

export function deactivate(): Thenable<void> | undefined {
if (!client){
if(!client)
return undefined;
}
return client.stop();
}
Loading