Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
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}"
]
}
]
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"activationEvents": [
"onLanguage:ros1"
],
"main": "out/extension",
"main": "out/extension.js",
"contributes": {
"languages": [
{
Expand Down
48 changes: 32 additions & 16 deletions src/extension.ts
Original file line number Diff line number Diff line change
@@ -1,28 +1,44 @@
'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 = {
Expand All @@ -31,7 +47,7 @@ export function activate(context: ExtensionContext) {
fileEvents: workspace.createFileSystemWatcher('**/*.*')
}
};

// Create the language client and start the client.
lc = new LanguageClient('Xtext Server', serverOptions, clientOptions);

Expand Down
3 changes: 1 addition & 2 deletions syntaxes/ros.tmLanguage.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
}
]
}
},
"scopeName": "source.ros1"
}
}