How to use the vscode-languageserver.IPCMessageWriter function in vscode-languageserver

To help you get started, we’ve selected a few vscode-languageserver examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Azure / autorest / src / autorest-core / dist / language-service / language-service.js View on Github external
log(text) {
        this.connection.console.log(text);
    }
    verbose(text) {
        if (this.settings.verbose) {
            this.connection.console.log(text);
        }
    }
    verboseDebug(text) {
        if (this.settings.verbose && this.settings.debug) {
            this.connection.console.info(text);
        }
    }
}
// Create the IPC Channel for the lanaguage service.
let connection = vscode_languageserver_1.createConnection(new vscode_languageserver_1.IPCMessageReader(process), new vscode_languageserver_1.IPCMessageWriter(process));
let languageService = new OpenApiLanguageService(connection);
process.on("unhandledRejection", function (err) {
    //
    // @Future_Garrett - only turn this on as a desperate move of last resort.
    // You'll be sorry, and you will waste another day going down this rat hole
    // looking for the reason something is failing only to find out that it's only
    // during the detection if a file is swagger or not, and then you'll
    // realize why I wrote this message. Don't say I didn't warn you.
    // -- @Past_Garrett
    //
    // languageService.verboseDebug(`Unhandled Rejection Suppressed: ${err}`);
});
// Listen on the connection
connection.listen();
//# sourceMappingURL=language-service.js.map
github mrmlnc / vscode-doiuse / src / server.ts View on Github external
createConnection,
	IPCMessageReader,
	IPCMessageWriter,
	DiagnosticSeverity,
	Diagnostic,
	Files,
	ErrorMessageTracker,
	InitializeError,
	ResponseError
} from 'vscode-languageserver';

import * as postcss from 'postcss';
import * as micromatch from 'micromatch';
import * as resolver from 'npm-module-path';

const connection: IConnection = createConnection(new IPCMessageReader(process), new IPCMessageWriter(process));
const allDocuments: TextDocuments = new TextDocuments();

// "global" settings
let workspaceFolder;
let linter;
let editorSettings;

const doiuseNotFound: string = [
	'Failed to load doiuse library.',
	`Please install doiuse in your workspace folder using \'npm install doiuse\' or \'npm install -g doiuse\' and then press Retry.`
].join('');

function makeDiagnostic(problem): Diagnostic {
	const source = problem.usage.source;
	const message: string = problem.message.replace(/<input>:\d*:\d*:\s/, '');
github bungcip / better-toml / server / tomlServerMain.ts View on Github external
* Licensed under the MIT License. See License.txt in the project root for license information.
 * ------------------------------------------------------------------------------------------ */
'use strict';

import {
    IPCMessageReader, IPCMessageWriter,
	createConnection, IConnection,
	TextDocuments, TextDocument, Diagnostic, DiagnosticSeverity, 
	InitializeParams, InitializeResult
} from 'vscode-languageserver';

import * as toml from 'toml';
import {TomlSyntaxError} from 'toml';

// Create a connection for the server. The connection uses Node's IPC as a transport
let connection: IConnection = createConnection(new IPCMessageReader(process), new IPCMessageWriter(process));

// Create a simple text document manager. The text document manager
// supports full document sync only
let documents: TextDocuments = new TextDocuments();
// Make the text document manager listen on the connection
// for open, change and close text document events
documents.listen(connection);

// 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 => {
	workspaceRoot = params.rootPath;
	return {
		capabilities: {
			// Tell the client that the server works in FULL text document sync mode
github kumarharsh / graphql-for-vscode / src / server / server.ts View on Github external
import {
  commonNotifications,
  filePathToURI,
  makeDiagnostic,
  mapLocation,
  resolveModule,
  toGQLPosition,
  uriToFilePath,
} from './helpers';

const moduleName = '@playlyfe/gql';

// 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);

// Define server notifications to be sent to the client
const serverInitialized = new NotificationType0(
  commonNotifications.serverInitialized,
);
const serverExited = new NotificationType0(commonNotifications.serverExited);

// After the server has started the client sends an initilize request. The server receives
github mikrovvelle / mlxprs / server / server.ts View on Github external
import {
    IPCMessageReader, IPCMessageWriter,
    createConnection, IConnection,
    TextDocuments,
    InitializeResult, TextDocumentPositionParams,
    CompletionItem, CompletionItemKind, TextDocument
} from 'vscode-languageserver'

import {
    allMlSjsFunctions, allMlSjsNamespaces
} from './completionsSjs'
import {
    allMlXqyFunctions, allMlXqyNamespaces
} from './completionsXqy'

const connection: IConnection = createConnection(new IPCMessageReader(process), new IPCMessageWriter(process))

const documents: TextDocuments = new TextDocuments()
documents.listen(connection)

let workspaceRoot: string

connection.onInitialize((params): InitializeResult => {
    workspaceRoot = params.rootPath
    return {
        capabilities: {
            // Tell the client that the server works in FULL text document sync mode
            textDocumentSync: documents.syncKind,
            // Tell the client that the server supports code complete
            completionProvider: {
                resolveProvider: true,
                triggerCharacters: [':', '$', '.']
github joe-re / sql-language-server / server / server.js View on Github external
};
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const vscode_languageserver_1 = require("vscode-languageserver");
const log4js = __importStar(require("log4js"));
const cache_1 = __importDefault(require("./cache"));
const complete_1 = __importDefault(require("./complete"));
log4js.configure({
    appenders: { server: { type: 'file', filename: `${__dirname}/server.log` } },
    categories: { default: { appenders: ['server'], level: 'debug' } }
});
const logger = log4js.getLogger();
// Create a connection for the server. The connection uses Node's IPC as a transport
let connection = vscode_languageserver_1.createConnection(new vscode_languageserver_1.IPCMessageReader(process), new vscode_languageserver_1.IPCMessageWriter(process));
let documents = new vscode_languageserver_1.TextDocuments();
documents.listen(connection);
let shouldSendDiagnosticRelatedInformation = false;
connection.onInitialize((_params) => {
    shouldSendDiagnosticRelatedInformation = _params.capabilities && _params.capabilities.textDocument && _params.capabilities.textDocument.publishDiagnostics && _params.capabilities.textDocument.publishDiagnostics.relatedInformation;
    return {
        capabilities: {
            textDocumentSync: documents.syncKind,
            completionProvider: {
                resolveProvider: true,
                triggerCharacters: ['.'],
            }
        }
    };
});
// hold the maxNumberOfProblems setting
github HvyIndustries / crane / server / src / server.ts View on Github external
CompletionItemKind,
    TextDocumentPositionParams
} from 'vscode-languageserver';

import App from './app';
import Message from './util/Message';
import Context from './util/Context';
import Autocomplete from './suggestion';
import cmdRefresh from './commands/Refresh';

let instance:App = null;

// Initialise the connection with the client
let connection: IConnection = createConnection(
    new IPCMessageReader(process),
    new IPCMessageWriter(process)
);

// creates the debug instance
let out:Message = new Message(connection);

// loads the workspace definition
let documents: TextDocuments = new TextDocuments();
documents.listen(connection);

/**
 * Here the application starts
 */
connection.onInitialize((params): InitializeResult => {
    out.status("Starting crane");

    instance = new App(params.rootPath, params.initializationOptions);
github xsburg / vscode-javascript-booster / client / server / src / server.js View on Github external
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
    return new (P || (P = Promise))(function (resolve, reject) {
        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
        function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
        function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
        step((generator = generator.apply(thisArg, _arguments || [])).next());
    });
};
Object.defineProperty(exports, "__esModule", { value: true });
const vscode_languageserver_1 = require("vscode-languageserver");
const const_1 = require("./const");
const astService_1 = require("./services/astService");
const codeModService_1 = require("./services/codeModService");
const codeService_1 = require("./services/codeService");
let connection = vscode_languageserver_1.createConnection(new vscode_languageserver_1.IPCMessageReader(process), new vscode_languageserver_1.IPCMessageWriter(process));
codeService_1.default.initialize(connection);
let documents = new vscode_languageserver_1.TextDocuments();
documents.listen(connection);
connection.onInitialize((_params) => {
    return {
        capabilities: {
            textDocumentSync: documents.syncKind,
            codeActionProvider: true,
            executeCommandProvider: {
                commands: ['javascriptBooster.test1']
            }
        }
    };
});
documents.onDidChangeContent(change => {
    validateTextDocument(change.document);
github mariosangiorgio / vscode-ledger / server.ts View on Github external
'use strict';
import {IPCMessageReader, IPCMessageWriter, createConnection, IConnection, TextDocument, TextDocumentSyncKind, TextDocuments, Diagnostic, DiagnosticSeverity, InitializeParams, InitializeResult} from 'vscode-languageserver';
import {CompletionItem, CompletionItemKind, TextDocumentPositionParams} from 'vscode-languageserver';
import {Ledger} from 'ledger-cli';
import * as url from 'url';

let accounts : string[] = [];

let connection: IConnection = createConnection(new IPCMessageReader(process), new IPCMessageWriter(process));

connection.onCompletion((textDocumentPosition: TextDocumentPositionParams): CompletionItem[] => {
    return accounts.map((account, index) => {
        return {
            label: account,
            kind: CompletionItemKind.Text,
            data: index
        }
    })
});

let documents: TextDocuments = new TextDocuments();

documents.onDidOpen(params => {
    let ledger = new Ledger({ file: decodeURI(url.parse(params.document.uri).path) });
    ledger.accounts().on('data', account => accounts.push(account))
github APerricone / harbourCodeExtension / server / src / main.js View on Github external
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;
/** the list of documentation harbour base functions
 * @type {Array} */