Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import {
createConnection,
TextDocuments,
InitializeParams,
ProposedFeatures
} from "vscode-languageserver";
import { MLS } from "./service";
let mls: MLS;
// Create a connection for the server
// Also include all preview / proposed LSP features.
const connection =
process.argv.length <= 2
? createConnection(process.stdin, process.stdout) // no arg specified
: createConnection(ProposedFeatures.all);
const DEBUG = process.env.DEBUG === 'true' || false;
console.log = connection.console.log.bind(connection.console);
console.error = connection.console.error.bind(connection.console);
// Create a simple text document manager. The text document manager
// supports full document sync only
let documents: TextDocuments = new TextDocuments();
// let hasConfigurationCapability: boolean = false;
// let hasWorkspaceFolderCapability: boolean = false;
// let hasDiagnosticRelatedInformationCapability: boolean = false;
// After the server has started the client sends an initilize request. The server receives
// in the passed params the rootPath of the workspace plus the client capabilites.
InitializeParams,
DidChangeConfigurationNotification,
ExecuteCommandParams,
// Position,
// MessageType,
// LogMessageNotification,
// WillSaveTextDocumentWaitUntilRequest,
// TextDocumentSaveReason,
WorkspaceFolder as _WorkspaceFolder,
CompletionItem,
FileChangeType,
} from 'vscode-languageserver';
// Create a connection for the server. The connection uses Node's IPC as a transport.
// Also include all preview / proposed LSP features.
let connection = createConnection(ProposedFeatures.all);
// Create a simple text document manager. The text document manager
// supports full document sync only
let documents: TextDocuments = new TextDocuments();
const snippets = new Snippets();
const workspaceFolders = new WorkspaceFolders(connection);
let hasConfigurationCapability: boolean = false;
let hasWorkspaceFolderCapability: boolean = false;
// let hasDiagnosticRelatedInformationCapability: boolean = false;
connection.onInitialize((params: InitializeParams) => {
workspaceFolders.create(
params.workspaceFolders || [{ uri: params.rootUri || '', name: '' }]
);
ResponseError,
TextDocument,
TextDocuments,
} from 'vscode-languageserver';
import { ExecuteCommandParams } from 'vscode-languageserver/lib/protocol';
import Uri from 'vscode-uri';
import * as fs from "fs";
import * as path from "path";
import * as _ from "lodash";
import { Settings } from "./settings";
import { Linter } from "./linters/linter";
import { Flexelint } from './linters/flexelint';
import { CppCheck } from './linters/cppcheck';
// Create a connection for the server. The connection uses Node's IPC as a transport.
const connection: IConnection = createConnection(new IPCMessageReader(process), new IPCMessageWriter(process));
// Create a simple text document manager. The text document manager supports full document sync only.
const documents: TextDocuments = new TextDocuments();
// Make the text document manager listen on the connection for open, change, and close text document events.
documents.listen(connection);
let settings: Settings;
let linters: Linter[] = [];
// After the server has started the client sends an initialize request.
// The server receives in the passed params the rootPath of the workspace plus the client capabilities.
let workspaceRoot: string;
connection.onInitialize((params): InitializeResult => {
let workspaceUri = Uri.parse(params.rootUri!);
document2Library.get(document.uri)!.then(async library => {
if (!library) {
return
}
try {
trace('validateTextDocument: about to validate ' + document.uri)
connection.sendNotification(StatusNotification.type, { state: Status.ok })
let diagnostics = await doValidate(connection, library, document)
connection.sendDiagnostics({ uri, diagnostics })
} catch (err) {
connection.window.showErrorMessage(getErrorMessage(err, document))
}
})
}
let connection: server.IConnection = server.createConnection(
new server.IPCMessageReader(process),
new server.IPCMessageWriter(process)
)
console.log = connection.console.log.bind(connection.console)
console.error = connection.console.error.bind(connection.console)
let documents: server.TextDocuments = new server.TextDocuments()
documents.listen(connection)
function trace(message: string, verbose?: string): void {
connection.tracer.log(message, verbose)
}
connection.onInitialize(params => {
function hasClientCapability(name: string) {
document2Library.get(document.uri)!.then(async library => {
if (!library) {
return
}
try {
trace('validateTextDocument: about to validate ' + document.uri)
connection.sendNotification(StatusNotification.type, {state: Status.ok})
let diagnostics = await doValidate(connection, library, document)
connection.sendDiagnostics({uri, diagnostics})
} catch (err) {
connection.window.showErrorMessage(getErrorMessage(err, document))
}
})
}
let connection: server.IConnection = server.createConnection(
new server.IPCMessageReader(process),
new server.IPCMessageWriter(process)
)
console.log = connection.console.log.bind(connection.console)
console.error = connection.console.error.bind(connection.console)
let documents: server.TextDocuments = new server.TextDocuments()
documents.listen(connection)
function trace(message: string, verbose?: string): void {
connection.tracer.log(message, verbose)
}
connection.onInitialize(params => {
function hasClientCapability(name: string) {
constructor() {
this.loadOperators();
this.loadDocumentation();
this.connection = createConnection(new IPCMessageReader(process), new IPCMessageWriter(process));
this.documents = new TextDocuments();
this.documents.listen(this.connection);
this.connection.onInitialize((params) => this.onInitialize(params));
this.connection.onHover((params) => this.onHover(params));
this.connection.onReferences((params) => this.onReferences(params));
this.connection.onDefinition((params) => this.onDefinition(params));
this.connection.onSignatureHelp((params) => this.onSignatureHelp(params));
this.connection.onCompletion((params) => this.onCompletion(params));
this.connection.onCompletionResolve((params) => this.onCompletionResolve(params));
this.documents.onDidChangeContent((params) => this.parseDocument(params.document));
this.connection.listen();
export function start(reader: MessageReader, writer: MessageWriter): ShellLanguageServer {
const connection = createConnection(reader, writer);
const server = new ShellLanguageServer(connection);
server.start();
return server;
}
export function startServer() {
const connection = process.argv.includes('--stdio') ? createConnection(process.stdin, process.stdout) : createConnection(
new IPCMessageReader(process),
new IPCMessageWriter(process),
);
const manager = new DocumentManager(
textDocument => new SvelteDocument(textDocument.uri, textDocument.text),
);
manager.register(new SveltePlugin());
manager.register(new HTMLPlugin());
manager.register(wrapFragmentPlugin(new CSSPlugin(), CSSPlugin.matchFragment));
manager.register(wrapFragmentPlugin(new TypeScriptPlugin(), TypeScriptPlugin.matchFragment));
connection.onInitialize(evt => {
return {
capabilities: {
var provider = require('./provider.js');
var server = require('vscode-languageserver')
var fs = require("fs");
var path = require("path");
var Uri = require("vscode-uri").default;
var connection = server.createConnection(
new server.IPCMessageReader(process),
new server.IPCMessageWriter(process));
/** @type {Array} */
var workspaceRoots;
/** @type {Array} */
var includeDirs;
/** @type {number} */
var workspaceDepth;
/** @type {boolean} */
var wordBasedSuggestions;
/** @type {Object.} */
var files;
/** @type {Object.} */
var includes;