@@ -5,8 +5,8 @@ import * as wsrpc from '@sourcegraph/vscode-ws-jsonrpc'
55import { ajax } from 'rxjs/ajax'
66import * as sourcegraph from 'sourcegraph'
77import * as rpc from 'vscode-jsonrpc'
8- import * as lsp from 'vscode-languageserver-protocol'
9- import * as LSP from 'vscode-languageserver-types'
8+ import * as lspProtocol from 'vscode-languageserver-protocol'
9+ import * as lspTypes from 'vscode-languageserver-types'
1010import * as convert from './convert-lsp-to-sea'
1111import * as lspext from './lspext'
1212
@@ -226,13 +226,13 @@ async function connectAndInitialize(
226226 connection . listen ( )
227227 try {
228228 await connection . sendRequest (
229- new lsp . RequestType <
230- lsp . InitializeParams & {
229+ new lspProtocol . RequestType <
230+ lspProtocol . InitializeParams & {
231231 originalRootUri : string
232232 rootPath : string
233233 } ,
234- lsp . InitializeResult ,
235- lsp . InitializeError ,
234+ lspProtocol . InitializeResult ,
235+ lspProtocol . InitializeError ,
236236 void
237237 > ( 'initialize' ) as any ,
238238 {
@@ -256,7 +256,7 @@ async function connectAndInitialize(
256256 throw e
257257 }
258258
259- connection . sendNotification ( lsp . InitializedNotification . type )
259+ connection . sendNotification ( lspProtocol . InitializedNotification . type )
260260
261261 return connection
262262}
@@ -487,7 +487,7 @@ function xrefs({
487487 const candidates = ( async ( ) => {
488488 const definitions = ( await sendRequest ( {
489489 rootURI : rootURIFromDoc ( doc ) ,
490- requestType : new lsp . RequestType < any , any , any , void > ( 'textDocument/xdefinition' ) as any ,
490+ requestType : new lspProtocol . RequestType < any , any , any , void > ( 'textDocument/xdefinition' ) as any ,
491491 request : positionParams ( doc , pos ) ,
492492 useCache : true ,
493493 } ) ) as lspext . Xdefinition [ ] | null
@@ -541,7 +541,7 @@ function xrefs({
541541 // by `new Set` above), rendering caching useless.
542542 const response = ( await sendRequest ( {
543543 rootURI,
544- requestType : new lsp . RequestType < any , any , any , void > ( 'workspace/xreferences' ) as any ,
544+ requestType : new lspProtocol . RequestType < any , any , any , void > ( 'workspace/xreferences' ) as any ,
545545 // tslint:disable-next-line:no-object-literal-type-assertion
546546 request : {
547547 query : definition . symbol ,
@@ -558,7 +558,7 @@ function xrefs({
558558 )
559559}
560560
561- function positionParams ( doc : sourcegraph . TextDocument , pos : sourcegraph . Position ) : lsp . TextDocumentPositionParams {
561+ function positionParams ( doc : sourcegraph . TextDocument , pos : sourcegraph . Position ) : lspProtocol . TextDocumentPositionParams {
562562 return {
563563 textDocument : {
564564 uri : `file:///${ new URL ( doc . uri ) . hash . slice ( 1 ) } ` ,
@@ -641,7 +641,7 @@ function registerImplementations({
641641 sendRequest,
642642} : {
643643 ctx : sourcegraph . ExtensionContext
644- sendRequest : SendRequest < LSP . Location [ ] | null >
644+ sendRequest : SendRequest < lspTypes . Location [ ] | null >
645645} ) : void {
646646 // Implementations panel.
647647 const IMPL_ID = 'go.impl' // implementations panel and provider ID
@@ -650,7 +650,7 @@ function registerImplementations({
650650 provideLocations : async ( doc : sourcegraph . TextDocument , pos : sourcegraph . Position ) => {
651651 const response = await sendRequest ( {
652652 rootURI : rootURIFromDoc ( doc ) ,
653- requestType : lsp . ImplementationRequest . type ,
653+ requestType : lspProtocol . ImplementationRequest . type ,
654654 request : positionParams ( doc , pos ) ,
655655 useCache : true ,
656656 } )
@@ -712,9 +712,9 @@ export async function initLSP(ctx: sourcegraph.ExtensionContext): Promise<MaybeP
712712
713713 const hover = async ( doc : sourcegraph . TextDocument , pos : sourcegraph . Position ) =>
714714 convert . hover (
715- await sendRequest < LSP . Hover | null > ( {
715+ await sendRequest < lspTypes . Hover | null > ( {
716716 rootURI : rootURIFromDoc ( doc ) ,
717- requestType : lsp . HoverRequest . type ,
717+ requestType : lspProtocol . HoverRequest . type ,
718718 request : positionParams ( doc , pos ) ,
719719 useCache : true ,
720720 } )
@@ -725,7 +725,7 @@ export async function initLSP(ctx: sourcegraph.ExtensionContext): Promise<MaybeP
725725 currentDocURI : doc . uri ,
726726 xdefinition : await sendRequest < lspext . Xdefinition [ ] | null > ( {
727727 rootURI : rootURIFromDoc ( doc ) ,
728- requestType : new lsp . RequestType < any , any , any , void > ( 'textDocument/xdefinition' ) as any ,
728+ requestType : new lspProtocol . RequestType < any , any , any , void > ( 'textDocument/xdefinition' ) as any ,
729729 request : positionParams ( doc , pos ) ,
730730 useCache : true ,
731731 } ) ,
@@ -734,9 +734,9 @@ export async function initLSP(ctx: sourcegraph.ExtensionContext): Promise<MaybeP
734734 const references = async ( doc : sourcegraph . TextDocument , pos : sourcegraph . Position ) =>
735735 convert . references ( {
736736 currentDocURI : doc . uri ,
737- references : await sendRequest < LSP . Location [ ] > ( {
737+ references : await sendRequest < lspTypes . Location [ ] > ( {
738738 rootURI : rootURIFromDoc ( doc ) ,
739- requestType : lsp . ReferencesRequest . type ,
739+ requestType : lspProtocol . ReferencesRequest . type ,
740740 request : positionParams ( doc , pos ) ,
741741 useCache : true ,
742742 } ) ,
@@ -805,7 +805,7 @@ const goFiles = [{ pattern: '*.go' }]
805805export function activate ( ctx : sourcegraph . ExtensionContext = DUMMY_CTX ) : void {
806806 async function afterActivate ( ) : Promise < void > {
807807 const lsif = initLSIF ( )
808- const lsp = await initLSP ( ctx ) . catch ( ( ) => noopMaybeProviders )
808+ const lsp = await initLSP ( ctx ) . catch < MaybeProviders > ( ( ) => noopMaybeProviders )
809809 const basicCodeIntel = initBasicCodeIntel ( )
810810
811811 ctx . subscriptions . add (
0 commit comments