Skip to content
This repository has been archived by the owner on Dec 15, 2022. It is now read-only.

Commit

Permalink
Move LanguageServerProcess to lib/server-manager.js
Browse files Browse the repository at this point in the history
  • Loading branch information
daviwil committed Feb 15, 2018
1 parent 32a7254 commit a449d20
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 19 deletions.
21 changes: 3 additions & 18 deletions lib/auto-languageclient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ import * as rpc from 'vscode-jsonrpc';
import * as path from 'path';
import * as atomIde from 'atom-ide';
import * as linter from 'atom-linter';
import * as stream from 'stream';
import { Socket } from 'net';
import { EventEmitter } from 'events';
import { ConsoleLogger, NullLogger, Logger } from './logger';
import { ServerManager, ActiveServer } from './server-manager.js';
import { LanguageServerProcess, ServerManager, ActiveServer } from './server-manager.js';
import Convert from './convert.js';

export { LanguageServerProcess };

import {
AutocompleteDidInsert,
AutocompleteProvider,
Expand Down Expand Up @@ -39,21 +39,6 @@ import SignatureHelpAdapter from './adapters/signature-help-adapter';

export type ConnectionType = 'stdio' | 'socket' | 'ipc';

// Public: Defines the minimum surface area for an object that resembles a
// ChildProcess. This is used so that language packages with alternative
// language server process hosting strategies can return something compatible
// with AutoLanguageClient.startServerProcess.
export interface LanguageServerProcess extends EventEmitter {
stdin: stream.Writable;
stdout: stream.Readable;
stderr: stream.Readable;
pid: number;

kill(signal?: string): void;
on(event: 'error', listener: (err: Error) => void): this;
on(event: 'exit', listener: (code: number, signal: string) => void): this;
}

// Public: AutoLanguageClient provides a simple way to have all the supported
// Atom-IDE services wired up entirely for you by just subclassing it and
// implementing startServerProcess/getGrammarScopes/getLanguageName and
Expand Down
19 changes: 18 additions & 1 deletion lib/server-manager.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,37 @@
import { Logger } from './logger';
import { EventEmitter } from 'events';
import LinterPushV2Adapter from './adapters/linter-push-v2-adapter';
import DocumentSyncAdapter from './adapters/document-sync-adapter';
import SignatureHelpAdapter from './adapters/signature-help-adapter';

import * as path from 'path';
import * as stream from 'stream';
import * as cp from 'child_process';
import * as ls from './languageclient';
import * as atomIde from 'atom-ide';
import Convert from './convert';
import { CompositeDisposable, ProjectFileEvent, TextEditor } from 'atom';

// Public: Defines the minimum surface area for an object that resembles a
// ChildProcess. This is used so that language packages with alternative
// language server process hosting strategies can return something compatible
// with AutoLanguageClient.startServerProcess.
export interface LanguageServerProcess extends EventEmitter {
stdin: stream.Writable;
stdout: stream.Readable;
stderr: stream.Readable;
pid: number;

kill(signal?: string): void;
on(event: 'error', listener: (err: Error) => void): this;
on(event: 'exit', listener: (code: number, signal: string) => void): this;
}

// The necessary elements for a server that has started or is starting.
export interface ActiveServer {
disposable: CompositeDisposable;
projectPath: string;
process: cp.ChildProcess;
process: LanguageServerProcess;
connection: ls.LanguageClientConnection;
capabilities: ls.ServerCapabilities;
linterPushV2?: LinterPushV2Adapter;
Expand Down

0 comments on commit a449d20

Please sign in to comment.