How to use the vscode-languageserver-protocol.RequestType function in vscode-languageserver-protocol

To help you get started, we’ve selected a few vscode-languageserver-protocol 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 sourcegraph / sourcegraph-go / src / lang-go.ts View on Github external
const webSocket = new WebSocket(address)
            const conn = createWebSocketConnection(wsrpc.toSocket(webSocket), new ConsoleLogger())
            webSocket.addEventListener('open', () => resolve(conn))
            webSocket.addEventListener('error', event => reject(new Error(connectingToGoLangserverHelp)))
        } catch (e) {
            if ('message' in e && /Failed to construct/.test(e.message)) {
                console.error(connectingToGoLangserverHelp)
            }
            reject(e)
        }
    })) as rpc.MessageConnection

    connection.listen()
    try {
        await connection.sendRequest(
            new lspProtocol.RequestType<
                lspProtocol.InitializeParams & {
                    originalRootUri: string
                    rootPath: string
                },
                lspProtocol.InitializeResult,
                lspProtocol.InitializeError,
                void
            >('initialize') as any,
            {
                originalRootUri: root.href,
                rootUri: 'file:///',
                rootPath: '/',
                initializationOptions: {
                    zipURL: constructZipURL({
                        repoName: repoName(root.href).replace(/^\/+/, ''),
                        revision: root.search.substr(1),
github sourcegraph / sourcegraph-go / src / lang-go.ts View on Github external
const candidates = (async () => {
        const definitions = (await sendRequest({
            rootURI: rootURIFromDoc(doc),
            requestType: new lspProtocol.RequestType('textDocument/xdefinition') as any,
            request: positionParams(doc, pos),
            useCache: true,
        })) as lspext.Xdefinition[] | null
        if (!definitions) {
            console.error('No response to xdefinition')
            return Promise.reject()
        }
        if (definitions.length === 0) {
            console.error('No definitions')
            return Promise.reject()
        }
        const definition = definitions[0]
        const limit = sourcegraph.configuration.get().get('go.maxExternalReferenceRepos') || 20
        const gddoURL = sourcegraph.configuration.get().get('go.gddoURL')
        const corsAnywhereURL = sourcegraph.configuration.get().get('go.corsAnywhereURL')
        function composeForward(f: (a: A) => B, g: (b: B) => C): (a: A) => C {
github neoclide / coc-tslint / src / index.ts View on Github external
AllFixesParams,
    AllFixesResult,
    void,
    void
    >('textDocument/tslint/allFixes')
}

interface NoTSLintLibraryParams {
  readonly source: TextDocumentIdentifier
}

interface NoTSLintLibraryResult {
}

namespace NoTSLintLibraryRequest {
  export const type = new RequestType('tslint/noLibrary')
}

interface Settings {
  enable: boolean
  jsEnable: boolean
  rulesDirectory: string | string[]
  configFile: string
  tsConfigFile: string
  ignoreDefinitionFiles: boolean
  exclude: string | string[]
  validateWithDefaultConfig: boolean
  nodePath: string | undefined
  run: 'onSave' | 'onType'
  alwaysShowRuleFailuresAsWarnings: boolean
  autoFixOnSave: boolean | string[]
  trace: any
github neoclide / coc.nvim / src / extensions / tslint / index.ts View on Github external
const errorRegex = /^(\w+):\s+([^\[]+)\[(\d+),\s*(\d+)\]:\s+(.*)$/

interface AllFixesParams {
  readonly textDocument: TextDocumentIdentifier
  readonly isOnSave: boolean
}

interface AllFixesResult {
  readonly documentVersion: number
  readonly edits: TextEdit[]
  readonly ruleId?: string
  readonly overlappingFixes: boolean
}

namespace AllFixesRequest {
  export const type = new RequestType<
    AllFixesParams,
    AllFixesResult,
    void,
    void
    >('textDocument/tslint/allFixes')
}

interface NoTSLintLibraryParams {
  readonly source: TextDocumentIdentifier
}

interface NoTSLintLibraryResult {
}

namespace NoTSLintLibraryRequest {
  export const type = new RequestType('tslint/noLibrary')
github neoclide / coc.nvim / src / extensions / eslint / index.ts View on Github external
autoFixOnSave: boolean
  options: any | undefined
  run: RunValues
  workspaceFolder: WorkspaceFolder | undefined
  workingDirectory: DirectoryItem | undefined
}

interface NoConfigParams {
  message: string
  document: TextDocumentIdentifier
}

interface NoConfigResult { }

namespace NoConfigRequest {
  export const type = new RequestType<
    NoConfigParams,
    NoConfigResult,
    void,
    void
    >('eslint/noConfig')
}

interface NoESLintLibraryParams {
  source: TextDocumentIdentifier
}

interface NoESLintLibraryResult { }

namespace NoESLintLibraryRequest {
  export const type = new RequestType<
    NoESLintLibraryParams,
github neoclide / coc-tslint / src / index.ts View on Github external
const errorRegex = /^\s*(\w+):\s+([^:]+):(\d+):\s*(\d+)\s+-\s+(.*)/

interface AllFixesParams {
  readonly textDocument: TextDocumentIdentifier
  readonly isOnSave: boolean
}

interface AllFixesResult {
  readonly documentVersion: number
  readonly edits: TextEdit[]
  readonly ruleId?: string
  readonly overlappingFixes: boolean
}

namespace AllFixesRequest {
  export const type = new RequestType<
    AllFixesParams,
    AllFixesResult,
    void,
    void
    >('textDocument/tslint/allFixes')
}

interface NoTSLintLibraryParams {
  readonly source: TextDocumentIdentifier
}

interface NoTSLintLibraryResult {
}

namespace NoTSLintLibraryRequest {
  export const type = new RequestType('tslint/noLibrary')
github microsoft / vscode / extensions / html / server / src / protocol / foldingProvider.proposed.ts View on Github external
}

export interface FoldingRangeRequestParam {
	/**
	 * The text document.
	 */
	textDocument: TextDocumentIdentifier;

	/**
	 * The maximum number of ranges to provide
	 */
	maxRanges?: number;
}

export namespace FoldingRangesRequest {
	export const type: RequestType = new RequestType('textDocument/foldingRanges');
}
github neoclide / coc-tslint / lib / index.js View on Github external
(function (AllFixesRequest) {
    AllFixesRequest.type = new vscode_languageserver_protocol_1.RequestType('textDocument/tslint/allFixes');
})(AllFixesRequest || (AllFixesRequest = {}));
var NoTSLintLibraryRequest;