@@ -11,7 +11,6 @@ import {
1111 authentication
1212} from 'vscode' ;
1313
14- import * as Cache from 'vscode-cache' ;
1514import {
1615 DocumentSelector ,
1716 LanguageClient ,
@@ -40,11 +39,11 @@ export let client: LanguageClient;
4039/**
4140 * Cache for cookies from REST requests to InterSystems servers.
4241 */
43- let cookiesCache : Cache ;
42+ const cookiesCache : Map < string , string [ ] > = new Map ( ) ;
4443
45- export async function updateCookies ( newCookies : string [ ] , server : ServerSpec ) : Promise < string [ ] > {
44+ export function updateCookies ( newCookies : string [ ] , server : ServerSpec ) : string [ ] {
4645 const key = `${ server . username } @${ server . host } :${ server . port } ${ server . pathPrefix } ` ;
47- const cookies = cookiesCache . get ( key , [ ] ) ;
46+ const cookies = cookiesCache . get ( key ) ?? [ ] ;
4847 newCookies . forEach ( ( cookie ) => {
4948 const [ cookieName ] = cookie . split ( "=" ) ;
5049 const index = cookies . findIndex ( ( el ) => el . startsWith ( cookieName ) ) ;
@@ -54,15 +53,15 @@ export async function updateCookies(newCookies: string[], server: ServerSpec): P
5453 cookies . push ( cookie ) ;
5554 }
5655 } ) ;
57- await cookiesCache . put ( key , cookies ) ;
56+ cookiesCache . set ( key , cookies ) ;
5857 return cookies ;
5958}
6059
6160export function getCookies ( server : ServerSpec ) : string [ ] {
62- return cookiesCache . get ( `${ server . username } @${ server . host } :${ server . port } ${ server . pathPrefix } ` , [ ] ) ;
61+ return cookiesCache . get ( `${ server . username } @${ server . host } :${ server . port } ${ server . pathPrefix } ` ) ?? [ ] ;
6362}
6463
65- let objectScriptApi ;
64+ let objectScriptApi : any ;
6665let serverManagerApi : serverManager . ServerManagerAPI ;
6766
6867/** Resolved connection information for each workspace folder */
@@ -80,10 +79,9 @@ type MakeRESTRequestParams = {
8079
8180export async function activate ( context : ExtensionContext ) {
8281 // Get the main extension exported API
83- const objectScriptExt = extensions . getExtension ( "intersystems-community.vscode-objectscript" ) ;
82+ const objectScriptExt = extensions . getExtension ( "intersystems-community.vscode-objectscript" ) ! ;
8483 objectScriptApi = objectScriptExt . isActive ? objectScriptExt . exports : await objectScriptExt . activate ( ) ;
8584
86- cookiesCache = new Cache ( context , "cookies" ) ;
8785 // The server is implemented in node
8886 let serverModule = context . asAbsolutePath (
8987 path . join ( 'server' , 'out' , 'server.js' )
@@ -258,7 +256,7 @@ export async function activate(context: ExtensionContext) {
258256 // Can't use the FileSystem with a DocumentContentProvider, so fetch the text directly from the server
259257 const uriParams = new URLSearchParams ( uri . query ) ;
260258 const fileName =
261- uriParams . has ( "csp" ) && [ "" , "1" ] . includes ( uriParams . get ( "csp" ) )
259+ uriParams . has ( "csp" ) && [ "" , "1" ] . includes ( uriParams . get ( "csp" ) ?? "" )
262260 ? uri . path . slice ( 1 )
263261 : uri . path . split ( "/" ) . slice ( 1 ) . join ( "." ) ;
264262 const docParams =
@@ -303,7 +301,7 @@ export async function activate(context: ExtensionContext) {
303301 "intersystems.language-server" ,
304302 workspace . workspaceFolders != undefined ? workspace . workspaceFolders [ 0 ] : undefined
305303 ) . get ( "suggestTheme" ) === true &&
306- ! workbenchConfig . get < string > ( "colorTheme" ) . startsWith ( "InterSystems Default " )
304+ ! workbenchConfig . get < string > ( "colorTheme" ) ? .startsWith ( "InterSystems Default " )
307305 ) {
308306 // Suggest an InterSystems default theme depending on the current active theme type
309307 if ( window . activeColorTheme . kind === ColorThemeKind . Light ) {
@@ -393,7 +391,7 @@ export async function deactivate(): Promise<void> {
393391 makeRESTRequest (
394392 "HEAD" ,
395393 0 ,
396- undefined ,
394+ "" ,
397395 serverSpec ,
398396 undefined ,
399397 undefined ,
0 commit comments