Skip to content

Commit

Permalink
upgrading to LSP 5.3.0
Browse files Browse the repository at this point in the history
LSP dependencies are targeting es6 now,
we are forced to use babel in order to transpile es6 to es5 classes for these dependencies

Signed-off-by: Anton Kosyakov <[email protected]>
  • Loading branch information
akosyakov committed Aug 9, 2019
1 parent 441ce8e commit 0751947
Show file tree
Hide file tree
Showing 9 changed files with 1,029 additions and 62 deletions.
5 changes: 5 additions & 0 deletions dev-packages/application-manager/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,12 @@
"test": "theiaext test"
},
"dependencies": {
"@babel/core": "^7.5.5",
"@babel/plugin-transform-classes": "^7.5.5",
"@babel/plugin-transform-runtime": "^7.5.5",
"@babel/preset-env": "^7.5.5",
"@theia/application-package": "^0.9.0",
"babel-loader": "^8.0.6",
"bunyan": "^1.8.10",
"circular-dependency-plugin": "^5.0.0",
"copy-webpack-plugin": "^4.5.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,26 @@ module.exports = {
test: /\\.plist$/,
loader: "file-loader",
},
{
test: /\\.js$/,
// include only es6 dependencies to transpile them to es5 classes
include: /monaco-languageclient|vscode-ws-jsonrpc|vscode-jsonrpc|vscode-languageserver-protocol|vscode-languageserver-types|vscode-languageclient/,
use: {
loader: 'babel-loader',
options: {
presets: ['@babel/preset-env'],
plugins: [
// reuse runtime babel lib instead of generating it in each js file
'@babel/plugin-transform-runtime',
// ensure that classes are transpiled
'@babel/plugin-transform-classes'
],
// see https://github.com/babel/babel/issues/8900#issuecomment-431240426
sourceType: 'unambiguous',
cacheDirectory: true
}
}
}
]
},
resolve: {
Expand Down
10 changes: 7 additions & 3 deletions packages/callhierarchy/src/browser/callhierarchy-context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import { ILanguageClient } from '@theia/languages/lib/browser';
import {
ReferencesRequest, DocumentSymbolRequest, DefinitionRequest, TextDocumentPositionParams,
TextDocumentIdentifier, SymbolInformation, Location, Position, DocumentSymbol, ReferenceParams
TextDocumentIdentifier, SymbolInformation, Location, Position, DocumentSymbol, ReferenceParams, LocationLink
} from 'monaco-languageclient/lib/services';
import * as utils from './utils';
import { ILogger, Disposable } from '@theia/core';
Expand Down Expand Up @@ -59,7 +59,7 @@ export class CallHierarchyContext implements Disposable {

// Definition can be null
// tslint:disable-next-line:no-null-keyword
let locations: Location | Location[] | null = null;
let locations: Location | Location[] | LocationLink[] | null = null;
try {
locations = await this.languageClient.sendRequest(DefinitionRequest.type, <TextDocumentPositionParams>{
position: Position.create(line, character),
Expand All @@ -71,7 +71,11 @@ export class CallHierarchyContext implements Disposable {
if (!locations) {
return undefined;
}
return Array.isArray(locations) ? locations[0] : locations;
const targetLocation = Array.isArray(locations) ? locations[0] : locations;
return LocationLink.is(targetLocation) ? {
uri: targetLocation.targetUri,
range: targetLocation.targetSelectionRange
} : targetLocation;
}

async getCallerReferences(definition: Location): Promise<Location[]> {
Expand Down
5 changes: 3 additions & 2 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"main": "lib/common/index.js",
"typings": "lib/common/index.d.ts",
"dependencies": {
"@babel/runtime": "^7.5.5",
"@phosphor/widgets": "^1.5.0",
"@primer/octicons-react": "^9.0.0",
"@theia/application-package": "^0.9.0",
Expand Down Expand Up @@ -39,9 +40,9 @@
"reconnecting-websocket": "^3.0.7",
"reflect-metadata": "^0.1.10",
"route-parser": "^0.0.5",
"vscode-languageserver-types": "^3.10.0",
"vscode-languageserver-types": "^3.15.0-next",
"vscode-uri": "^1.0.8",
"vscode-ws-jsonrpc": "^0.0.2-1",
"vscode-ws-jsonrpc": "^0.1.1",
"ws": "^5.2.2",
"yargs": "^11.1.0"
},
Expand Down
3 changes: 2 additions & 1 deletion packages/core/src/node/messaging/ipc-bootstrap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ const writer = new IPCMessageWriter(process);
const logger = new ConsoleLogger();
const connection = createMessageConnection(reader, writer, logger);
connection.trace(Trace.Off, {
log: (message, data) => console.log(`${message} ${data}`)
// tslint:disable-next-line:no-any
log: (message: any, data?: string) => console.log(message, data)
});

const entryPoint = require(ipcEntryPoint!).default as IPCEntryPoint;
Expand Down
3 changes: 2 additions & 1 deletion packages/core/src/node/messaging/ipc-connection-provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,8 @@ export class IPCConnectionProvider {
log: (message: string) => this.logger.info(`[${options.serverName}: ${childProcess.pid}] ${message}`)
});
connection.trace(Trace.Off, {
log: (message, data) => this.logger.info(`[${options.serverName}: ${childProcess.pid}] ${message} ${data}`)
// tslint:disable-next-line:no-any
log: (message: any, data?: string) => this.logger.info(`[${options.serverName}: ${childProcess.pid}] ${message}` + (typeof data === 'string' ? ' ' + data : ''))
});
return connection;
}
Expand Down
2 changes: 1 addition & 1 deletion packages/json/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"@theia/core": "^0.9.0",
"@theia/languages": "^0.9.0",
"@theia/monaco": "^0.9.0",
"vscode-json-languageserver": "^1.0.1"
"vscode-json-languageserver": "^1.2.1"
},
"devDependencies": {
"@theia/ext-scripts": "^0.9.0"
Expand Down
2 changes: 1 addition & 1 deletion packages/languages/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"@theia/workspace": "^0.9.0",
"@typefox/monaco-editor-core": "^0.14.6",
"@types/uuid": "^3.4.3",
"monaco-languageclient": "^0.9.0",
"monaco-languageclient": "next",
"uuid": "^3.2.1"
},
"publishConfig": {
Expand Down
Loading

0 comments on commit 0751947

Please sign in to comment.