diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..0e191b5 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,17 @@ +// A launch configuration that launches the extension 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", + "args": [ + "--extensionDevelopmentPath=${workspaceFolder}" + ] + } + ] +} \ No newline at end of file diff --git a/package.json b/package.json index f3577b2..1358308 100644 --- a/package.json +++ b/package.json @@ -1,12 +1,12 @@ { - "name": "ros1", - "displayName": "ros1", - "description": "ros1 language support", + "name": "ros", + "displayName": "ros", + "description": "ros language support", "version": "0.0.0", "publisher": "ipa-nhg", "repository": { "type": "git", - "url": "https://github.com/ipa-nhg/vscode-ros1tooling" + "url": "https://github.com/ipa-nhg/vscode-rostooling" }, "engines": { "vscode": "^1.49.0" @@ -15,27 +15,27 @@ "Programming Languages" ], "activationEvents": [ - "onLanguage:ros1" + "onLanguage:ros" ], - "main": "out/extension", + "main": "out/extension.js", "contributes": { "languages": [ { - "id": "ros1", + "id": "ros", "aliases": [ - "ros1" + "ros" ], "extensions": [ - ".ros1" + ".ros" ], "configuration": "./language-configuration.json" } ], "grammars": [ { - "language": "ros1", - "scopeName": "source.ros1", - "path": "./syntaxes/ros1.tmLanguage.json" + "language": "ros", + "scopeName": "source.ros", + "path": "./syntaxes/ros.tmLanguage.json" } ] }, @@ -45,7 +45,7 @@ "watch": "tsc -w -p .", "update-vscode": "node ./node_modules/vscode/bin/install", "build-viewer": "webpack --mode=production --config ./src/urdf/webpack.config.js", - "antlr4ts": "antlr4ts -visitor src/parser/DebugInternalros1components.g", + "antlr4ts": "antlr4ts -visitor src/parser/DebugInternalroscomponents.g", "build": "tsc -p ." }, "devDependencies": { diff --git a/src/extension.ts b/src/extension.ts index d737218..1f0a35e 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -1,50 +1,66 @@ 'use strict'; -import * as net from 'net'; +// import * as net from 'net'; +import { spawn } from 'child_process'; +import * as path from 'path'; //import {Trace} from 'vscode-jsonrpc'; //import { window, workspace, commands, ExtensionContext, Uri } from 'vscode'; import { workspace, ExtensionContext } from 'vscode'; -import { LanguageClient, LanguageClientOptions, StreamInfo } from 'vscode-languageclient/node'; +import { LanguageClient, LanguageClientOptions } from 'vscode-languageclient/node'; let lc: LanguageClient; export function activate(context: ExtensionContext) { - // The server is a started as a separate app and listens on port 5007 - let connectionInfo = { - host: "localhost", - port: 5008 - }; - let serverOptions = () => { - // Connect to language server via socket - let socket = net.connect(connectionInfo); - let result: StreamInfo = { - writer: socket, - reader: socket - }; - return Promise.resolve(result); + // // The server is a started as a separate app and listens on port 5007 + // let connectionInfo = { + // host: "localhost", + // port: 5008 + // }; + // let serverOptions = () => { + // // Connect to language server via socket + // let socket = net.connect(connectionInfo); + // let result: StreamInfo = { + // writer: socket, + // reader: socket + // }; + // return Promise.resolve(result); + // }; + + var serverOptions = function () { + // Connect to the language server via a io channel + var jar = context.asAbsolutePath(path.join('resources', 'de.fraunhofer.ipa.ros.xtext.ide-3.0.0-SNAPSHOT-ls.jar')); + var child = spawn('java', ['-Xdebug', '-Xrunjdwp:server=y,transport=dt_socket,address=8000,suspend=n,quiet=y', '-jar', jar, '-log debug']); + console.log(child.stdout.toString()); + child.stdout.on('data', function (chunk) { + console.log(chunk.toString()); + }); + child.stderr.on('data', function (chunk) { + console.error(chunk.toString()); + }); + return Promise.resolve(child); }; let clientOptions: LanguageClientOptions = { - documentSelector: ['ros1'], + documentSelector: ['ros'], synchronize: { fileEvents: workspace.createFileSystemWatcher('**/*.*') } }; - + // Create the language client and start the client. lc = new LanguageClient('Xtext Server', serverOptions, clientOptions); var disposable = lc.start(); /** - var disposable2 =commands.registerCommand("ros1.a.proxy", async () => { + var disposable2 =commands.registerCommand("ros.a.proxy", async () => { let activeEditor = window.activeTextEditor; - if (!activeEditor || !activeEditor.document || activeEditor.document.languageId !== 'ros1') { + if (!activeEditor || !activeEditor.document || activeEditor.document.languageId !== 'ros') { return; } if (activeEditor.document.uri instanceof Uri) { - commands.executeCommand("ros1.a", activeEditor.document.uri.toString()); + commands.executeCommand("ros.a", activeEditor.document.uri.toString()); } })*/ diff --git a/syntaxes/ros.tmLanguage.json b/syntaxes/ros.tmLanguage.json index ad07845..7839630 100644 --- a/syntaxes/ros.tmLanguage.json +++ b/syntaxes/ros.tmLanguage.json @@ -1,9 +1,9 @@ { "$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json", - "name": "ros1DSL", - "scopeName": "source.ros1", + "name": "rosDSL", + "scopeName": "source.ros", "fileTypes": [ - "ros1" + "ros" ], "patterns": [ { @@ -16,22 +16,21 @@ "repository": { "keywords": { "patterns": [{ - "name": "keyword.control.ros1", + "name": "keyword.control.ros", "match": "\\b(msgs|message)\\b" }] }, "strings": { - "name": "string.quoted.double.ros1", + "name": "string.quoted.double.ros", "begin": "\"", "end": "\"", "patterns": [ { - "name": "constant.character.escape.ros1", + "name": "constant.character.escape.ros", "match": "\\\\." } ] } - }, - "scopeName": "source.ros1" + } }