How to use the vscode-languageserver.IPCMessageReader 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 forcedotcom / salesforcedx-vscode / packages / salesforcedx-slds-linter / src / server / index.ts View on Github external
createConnection,
  Diagnostic,
  DiagnosticSeverity,
  IConnection,
  InitializeResult,
  IPCMessageReader,
  IPCMessageWriter,
  TextDocuments,
  TextEdit
} from 'vscode-languageserver';

import { nls } from '../messages';

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

// 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.
connection.onInitialize(
  (params): InitializeResult => {
    return {
      capabilities: {
github evanw / glslx-vscode / src / server.js View on Github external
function main() {
  connection = server.createConnection(
    new server.IPCMessageReader(process),
    new server.IPCMessageWriter(process));

  reportErrors(function() {
    // Listen to open documents
    openDocuments = new server.TextDocuments;
    openDocuments.listen(connection);
    openDocuments.onDidChangeContent(buildLater);

    // Grab the workspace when the connection opens
    connection.onInitialize(function(params) {
      workspaceRoot = params.rootPath || null;
      buildLater();
      return {
        capabilities: {
          textDocumentSync: openDocuments.syncKind,
          hoverProvider: true,
github microsoft / DevSkim-VSCode-Plugin / server / src / server.old.ts View on Github external
TextDocuments, TextDocument, Diagnostic,
    InitializeResult, RequestType, Command, TextEdit, TextDocumentIdentifier, DidChangeConfigurationNotification,
} from 'vscode-languageserver';

import {DevSkimProblem, Fixes, AutoFix, DevSkimSettings} from "./devskimObjects";
import {DevSkimWorker} from "./devskimWorker";

import {DevSkimSuppression} from "./suppressions";
import {DevSkimWorkerSettings} from "./devskimWorkerSettings";

let hasConfigurationCapability = false;
let hasWorkspaceFolderCapability = false;
let hasDiagnosticRelatedInformationCapability = false;

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

//Set up a new instance of a DevSkimWorker analysis engine.  This is the object that does all the real
//work of analyzing a file.
const dsWorkerSettings = new DevSkimWorkerSettings();
const dsSettings = dsWorkerSettings.getSettings();
const dsSuppression = new DevSkimSuppression(dsSettings);
const analysisEngine: DevSkimWorker = new DevSkimWorker(connection, dsSuppression);
github csstree / vscode-plugin / src / server.ts View on Github external
'use strict';

import path = require('path');
import { wrapper } from './wrapper';
import {
  IPCMessageReader, IPCMessageWriter,
  createConnection, IConnection, TextDocuments
} from 'vscode-languageserver';

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

function validate(document) {
  return wrapper({
    code: document.getText(),
    document,
    config,
  }).then(diagnostics => {
    connection.sendDiagnostics({ uri: document.uri, diagnostics });
  }).catch(err => {
    connection.window.showErrorMessage(err.stack.replace(/\n/g, ' '));
  });
}

function validateAll() {
  return Promise.all(documents.all().map(doc => validate(doc)));
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
github joe-re / sql-language-server / packages / server / createConnection.ts View on Github external
export default function createConnection(method: ConnectionMethod): IConnection {
  logger.debug(`createConnection: method {${method}}`)
  switch (method) {
    case 'stdio': return _createConnection(process.stdin, process.stdout)
    case 'node-ipc':
    default:
      return _createConnection(new IPCMessageReader(process), new IPCMessageWriter(process))
  }
}
github Dreae / sourcepawn-vscode / server / src / server.ts View on Github external
import { 
    IPCMessageReader, IPCMessageWriter ,IConnection, createConnection,
    TextDocuments, CompletionItemKind, CompletionItem, TextDocumentSyncKind
} from "vscode-languageserver";

import * as glob from 'glob';
import * as path from 'path';

import { Completion, CompletionRepository } from './completions';
import { parse_file } from './parser';

let connection = createConnection(new IPCMessageReader(process), new IPCMessageWriter(process));
let documents = new TextDocuments();
documents.listen(connection);

let completions = new CompletionRepository(documents);

let workspaceRoot: string;

connection.onInitialize((params) => {
    workspaceRoot = params.rootPath;

    return {
        capabilities: {
            textDocumentSync: documents.syncKind,
            completionProvider: {
                resolveProvider: false
            },