From fed52706def9a9f5d33edc7dd9848a02ae475ba5 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Fri, 7 Jun 2019 20:49:29 +0300 Subject: make LRU cache configurable --- editors/code/package.json | 5 +++++ editors/code/src/config.ts | 4 ++++ editors/code/src/server.ts | 3 ++- 3 files changed, 11 insertions(+), 1 deletion(-) (limited to 'editors') diff --git a/editors/code/package.json b/editors/code/package.json index 05c808394..c2ed8d126 100644 --- a/editors/code/package.json +++ b/editors/code/package.json @@ -232,6 +232,11 @@ ], "default": "off", "description": "Trace output of cargo-watch" + }, + "rust-analyzer.lruCapacity": { + "type": "number", + "default": null, + "description": "Number of syntax trees rust-analyzer keeps in memory" } } }, diff --git a/editors/code/src/config.ts b/editors/code/src/config.ts index 8d73a6b34..3024546d2 100644 --- a/editors/code/src/config.ts +++ b/editors/code/src/config.ts @@ -19,6 +19,7 @@ export class Config { public enableEnhancedTyping = true; public raLspServerPath = RA_LSP_DEBUG || 'ra_lsp_server'; public showWorkspaceLoadedNotification = true; + public lruCapacity: null | number = null; public cargoWatchOptions: CargoWatchOptions = { enableOnStartup: 'ask', trace: 'off', @@ -109,5 +110,8 @@ export class Config { '' ); } + if (config.has('lruCapacity')) { + this.lruCapacity = config.get('lruCapacity') as number; + } } } diff --git a/editors/code/src/server.ts b/editors/code/src/server.ts index 81c2b3fff..7029142fd 100644 --- a/editors/code/src/server.ts +++ b/editors/code/src/server.ts @@ -35,7 +35,8 @@ export class Server { initializationOptions: { publishDecorations: true, showWorkspaceLoaded: - Server.config.showWorkspaceLoadedNotification + Server.config.showWorkspaceLoadedNotification, + lruCapacity: Server.config.lruCapacity }, traceOutputChannel }; -- cgit v1.2.3