mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 09:19:04 -04:00
parent
c94fe45783
commit
4670868247
3 changed files with 16 additions and 9 deletions
|
@ -5,13 +5,13 @@
|
|||
*/
|
||||
import EventEmitter from 'events';
|
||||
import * as net from 'net';
|
||||
import { fileURLToPath } from 'url';
|
||||
import {
|
||||
createMessageConnection,
|
||||
MessageConnection,
|
||||
SocketMessageReader,
|
||||
SocketMessageWriter,
|
||||
} from 'vscode-jsonrpc';
|
||||
|
||||
import { RequestMessage, ResponseMessage } from 'vscode-jsonrpc/lib/messages';
|
||||
|
||||
import {
|
||||
|
@ -111,6 +111,7 @@ export class LanguageServerProxy implements ILanguageServerHandler {
|
|||
workspaceFolders,
|
||||
rootUri,
|
||||
capabilities: clientCapabilities,
|
||||
rootPath: fileURLToPath(rootUri),
|
||||
};
|
||||
return await clientConn
|
||||
.sendRequest(
|
||||
|
|
|
@ -8,6 +8,8 @@ import fs from 'fs';
|
|||
import mkdirp from 'mkdirp';
|
||||
import rimraf from 'rimraf';
|
||||
import sinon from 'sinon';
|
||||
import { pathToFileURL } from 'url';
|
||||
|
||||
import { ServerOptions } from '../server_options';
|
||||
import { LanguageServerProxy } from './proxy';
|
||||
import { InitializingError, RequestExpander } from './request_expander';
|
||||
|
@ -108,6 +110,7 @@ test('be able to open multiple workspace', async () => {
|
|||
params: [],
|
||||
workspacePath: '/tmp/test/workspace/1',
|
||||
};
|
||||
|
||||
const request2 = {
|
||||
method: 'request2',
|
||||
params: [],
|
||||
|
@ -122,7 +125,7 @@ test('be able to open multiple workspace', async () => {
|
|||
proxyStub.initialize.calledOnceWith({}, [
|
||||
{
|
||||
name: request1.workspacePath,
|
||||
uri: `file://${request1.workspacePath}`,
|
||||
uri: pathToFileURL(request1.workspacePath).href,
|
||||
},
|
||||
])
|
||||
).toBeTruthy();
|
||||
|
@ -134,7 +137,7 @@ test('be able to open multiple workspace', async () => {
|
|||
added: [
|
||||
{
|
||||
name: request2.workspacePath,
|
||||
uri: `file://${request2.workspacePath}`,
|
||||
uri: pathToFileURL(request2.workspacePath).href,
|
||||
},
|
||||
],
|
||||
removed: [],
|
||||
|
@ -178,13 +181,13 @@ test('be able to swap workspace', async () => {
|
|||
added: [
|
||||
{
|
||||
name: request2.workspacePath,
|
||||
uri: `file://${request2.workspacePath}`,
|
||||
uri: pathToFileURL(request2.workspacePath).href,
|
||||
},
|
||||
],
|
||||
removed: [
|
||||
{
|
||||
name: request1.workspacePath,
|
||||
uri: `file://${request1.workspacePath}`,
|
||||
uri: pathToFileURL(request1.workspacePath).href,
|
||||
},
|
||||
],
|
||||
},
|
||||
|
|
|
@ -6,8 +6,11 @@
|
|||
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
import { pathToFileURL } from 'url';
|
||||
|
||||
import { ResponseError, ResponseMessage } from 'vscode-jsonrpc/lib/messages';
|
||||
import { DidChangeWorkspaceFoldersParams, InitializeResult } from 'vscode-languageserver-protocol';
|
||||
|
||||
import { ServerNotInitialized } from '../../common/lsp_error_codes';
|
||||
import { LspRequest } from '../../model';
|
||||
import { ServerOptions } from '../server_options';
|
||||
|
@ -93,7 +96,7 @@ export class RequestExpander implements ILanguageServerHandler {
|
|||
removed: [
|
||||
{
|
||||
name: workspacePath!,
|
||||
uri: `file://${workspacePath}`,
|
||||
uri: pathToFileURL(workspacePath).href,
|
||||
},
|
||||
],
|
||||
added: [],
|
||||
|
@ -148,7 +151,7 @@ export class RequestExpander implements ILanguageServerHandler {
|
|||
[
|
||||
{
|
||||
name: workspacePath,
|
||||
uri: `file://${workspacePath}`,
|
||||
uri: pathToFileURL(workspacePath).href,
|
||||
},
|
||||
],
|
||||
this.initialOptions
|
||||
|
@ -227,7 +230,7 @@ export class RequestExpander implements ILanguageServerHandler {
|
|||
added: [
|
||||
{
|
||||
name: workspacePath!,
|
||||
uri: `file://${workspacePath}`,
|
||||
uri: pathToFileURL(workspacePath).href,
|
||||
},
|
||||
],
|
||||
removed: [],
|
||||
|
@ -247,7 +250,7 @@ export class RequestExpander implements ILanguageServerHandler {
|
|||
if (oldestWorkspace) {
|
||||
params.event.removed.push({
|
||||
name: oldestWorkspace,
|
||||
uri: `file://${oldestWorkspace}`,
|
||||
uri: pathToFileURL(oldestWorkspace).href,
|
||||
});
|
||||
this.removeWorkspace(oldestWorkspace);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue