Skip to content

Commit

Permalink
Merge pull request #2 from ipa320/Latest
Browse files Browse the repository at this point in the history
Merge open PR and re-generate the JAR files
  • Loading branch information
ipa-nhg authored Aug 1, 2024
2 parents 6872eb4 + f0232ce commit 356de4a
Show file tree
Hide file tree
Showing 4 changed files with 73 additions and 41 deletions.
17 changes: 17 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -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}"
]
}
]
}
26 changes: 13 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
@@ -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"
Expand All @@ -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"
}
]
},
Expand All @@ -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": {
Expand Down
56 changes: 36 additions & 20 deletions src/extension.ts
Original file line number Diff line number Diff line change
@@ -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());
}
})*/

Expand Down
15 changes: 7 additions & 8 deletions syntaxes/ros.tmLanguage.json
Original file line number Diff line number Diff line change
@@ -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": [
{
Expand All @@ -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"
}
}

0 comments on commit 356de4a

Please sign in to comment.