From 09aa6ce8347e383d6fb05750f51a23ac242717ac Mon Sep 17 00:00:00 2001 From: sockmaster27 <61235930+sockmaster27@users.noreply.github.com> Date: Sat, 11 Nov 2023 16:54:32 +0100 Subject: [PATCH 01/12] fix: only add source dirs included by compiler --- client/src/extension.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/client/src/extension.ts b/client/src/extension.ts index 168900ef..f4554293 100644 --- a/client/src/extension.ts +++ b/client/src/extension.ts @@ -36,7 +36,10 @@ let tomlWatcher: vscode.FileSystemWatcher const extensionObject = vscode.extensions.getExtension('flix.flix') -export const FLIX_GLOB_PATTERN = '**/*.flix' +export const FLIX_GLOB_PATTERN = new vscode.RelativePattern( + vscode.workspace.workspaceFolders?.[0], + '{*.flix,src/**/*.flix,test/**/*.flix}', +) export const FPKG_GLOB_PATTERN = new vscode.RelativePattern(vscode.workspace.workspaceFolders?.[0], 'lib/**/*.fpkg') export const JAR_GLOB_PATTERN = new vscode.RelativePattern(vscode.workspace.workspaceFolders?.[0], 'lib/**/*.jar') From d01f0a0fa7b4ad3dd021c5ca9c2dd02864332c4f Mon Sep 17 00:00:00 2001 From: sockmaster27 <61235930+sockmaster27@users.noreply.github.com> Date: Sun, 31 Dec 2023 15:15:53 +0100 Subject: [PATCH 02/12] refactor: add types to handlers --- server/src/handlers/handlers.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/server/src/handlers/handlers.ts b/server/src/handlers/handlers.ts index 88259feb..80b2c166 100644 --- a/server/src/handlers/handlers.ts +++ b/server/src/handlers/handlers.ts @@ -19,6 +19,7 @@ import { InitializeResult, InlayHintParams, ServerRequestHandler, + TextDocumentChangeEvent, TextDocumentSyncKind, } from 'vscode-languageserver' import { TextDocument } from 'vscode-languageserver-textdocument' @@ -153,13 +154,13 @@ export function handleExit() { engine.stop() } -export function handleSave(params: any) { +export function handleSave(params: TextDocumentChangeEvent) { if (engine.compileOnSaveEnabled()) { addUriToCompiler(params.document, true) } } -export function handleChangeContent(params: any) { +export function handleChangeContent(params: TextDocumentChangeEvent) { if (engine.compileOnChangeEnabled()) { // We send the document immediately to ensure better auto-complete. addUriToCompiler(params.document, true) From 05a6617efd044bc5103a57d8dbbbd851fddd04a1 Mon Sep 17 00:00:00 2001 From: sockmaster27 <61235930+sockmaster27@users.noreply.github.com> Date: Sun, 21 Jan 2024 15:07:09 +0100 Subject: [PATCH 03/12] chore: `fixAll` setting has set itself to "explicit" --- .vscode/settings.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index f25bd2e0..b95e2785 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -2,7 +2,7 @@ "json.schemaDownload.enable": true, "eslint.enable": true, "editor.codeActionsOnSave": { - "source.fixAll.eslint": true + "source.fixAll.eslint": "explicit" }, "editor.detectIndentation": false, "editor.formatOnSave": true, From ea9dab6855291dd640c326f7c8b3bb9dff583402 Mon Sep 17 00:00:00 2001 From: sockmaster27 <61235930+sockmaster27@users.noreply.github.com> Date: Sun, 21 Jan 2024 15:41:04 +0100 Subject: [PATCH 04/12] fix: don't include unwanted files on save and change --- server/src/engine/flix.ts | 7 ++++++- server/src/handlers/handlers.ts | 21 +++++++++++++++++++-- server/src/util/userMessages.ts | 4 ++++ 3 files changed, 29 insertions(+), 3 deletions(-) diff --git a/server/src/engine/flix.ts b/server/src/engine/flix.ts index c40bc760..e0ff378c 100644 --- a/server/src/engine/flix.ts +++ b/server/src/engine/flix.ts @@ -76,7 +76,12 @@ export function getExtensionVersion() { } export function getProjectRootUri() { - return _.first(startEngineInput.workspaceFolders) + const path = _.first(startEngineInput.workspaceFolders)! + + // This is the format that that VSCode forwards the URI in + const escapedPath = path.replace(':', '%3A') + + return new URL(`file:///${escapedPath}`) } export function updateUserConfiguration(userConfiguration: UserConfiguration) { diff --git a/server/src/handlers/handlers.ts b/server/src/handlers/handlers.ts index 80b2c166..830f3af2 100644 --- a/server/src/handlers/handlers.ts +++ b/server/src/handlers/handlers.ts @@ -18,7 +18,6 @@ import { InitializeParams, InitializeResult, InlayHintParams, - ServerRequestHandler, TextDocumentChangeEvent, TextDocumentSyncKind, } from 'vscode-languageserver' @@ -35,7 +34,7 @@ import { getProjectRootUri } from '../engine' import { USER_MESSAGE } from '../util/userMessages' import { StatusCode } from '../util/statusCodes' -const _ = require('lodash/fp') +import _ = require('lodash/fp') interface UriInput { uri: string @@ -168,6 +167,11 @@ export function handleChangeContent(params: TextDocumentChangeEvent new RegExp(regExpString)) + return regExps.some(regExp => regExp.test(uri)) +} + /** * @function */ @@ -382,6 +396,9 @@ function makeVersionResponseHandler(promiseResolver: () => void) { export function lspCheckResponseHandler({ status, result }: socket.FlixResponse) { clearDiagnostics() sendNotification(jobs.Request.internalDiagnostics, { status, result }) + + // TODO: Find out why TS doen't like this + // @ts-ignore _.each(sendDiagnostics, result) } diff --git a/server/src/util/userMessages.ts b/server/src/util/userMessages.ts index 22c63796..14e42cf3 100644 --- a/server/src/util/userMessages.ts +++ b/server/src/util/userMessages.ts @@ -43,4 +43,8 @@ export class USER_MESSAGE { static REQUEST_TIMEOUT(retries: number) { return `Could not send message after ${retries} retries. Websocket not available.` } + + static FILE_NOT_PART_OF_PROJECT() { + return `This file is not included in the project` + } } From aeadf90dd48cb5f0ea7582cb405e0aa42887023c Mon Sep 17 00:00:00 2001 From: sockmaster27 <61235930+sockmaster27@users.noreply.github.com> Date: Sun, 21 Jan 2024 15:51:24 +0100 Subject: [PATCH 05/12] chore: give more helpful message --- server/src/util/userMessages.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/src/util/userMessages.ts b/server/src/util/userMessages.ts index 14e42cf3..0ec2ca10 100644 --- a/server/src/util/userMessages.ts +++ b/server/src/util/userMessages.ts @@ -45,6 +45,6 @@ export class USER_MESSAGE { } static FILE_NOT_PART_OF_PROJECT() { - return `This file is not included in the project` + return `Only files in root, src/** and test/** are included` } } From f0e48675b809af01826683866806f1ab9ed617f0 Mon Sep 17 00:00:00 2001 From: sockmaster27 <61235930+sockmaster27@users.noreply.github.com> Date: Sat, 27 Jan 2024 20:51:19 +0100 Subject: [PATCH 06/12] Use `vscode-uri` --- server/package-lock.json | 11 +++++++++++ server/package.json | 1 + server/src/engine/flix.ts | 7 ++----- server/src/handlers/handlers.ts | 25 ++++++++++++++++++------- 4 files changed, 32 insertions(+), 12 deletions(-) diff --git a/server/package-lock.json b/server/package-lock.json index c8d74711..d65cb4e3 100644 --- a/server/package-lock.json +++ b/server/package-lock.json @@ -13,6 +13,7 @@ "portfinder": "^1.0.32", "vscode-languageserver": "^8.0.2", "vscode-languageserver-textdocument": "^1.0.8", + "vscode-uri": "^3.0.8", "ws": "^8.11.0" }, "devDependencies": { @@ -124,6 +125,11 @@ "resolved": "https://registry.npmjs.org/vscode-languageserver-types/-/vscode-languageserver-types-3.17.2.tgz", "integrity": "sha512-zHhCWatviizPIq9B7Vh9uvrH6x3sK8itC84HkamnBWoDFJtzBf7SWlpLCZUit72b3os45h6RWQNC9xHRDF8dRA==" }, + "node_modules/vscode-uri": { + "version": "3.0.8", + "resolved": "https://registry.npmjs.org/vscode-uri/-/vscode-uri-3.0.8.tgz", + "integrity": "sha512-AyFQ0EVmsOZOlAnxoFOGOq1SQDWAB7C6aqMGS23svWAllfOaxbuFvcT8D1i8z3Gyn8fraVeZNNmN6e9bxxXkKw==" + }, "node_modules/ws": { "version": "8.11.0", "resolved": "https://registry.npmjs.org/ws/-/ws-8.11.0.tgz", @@ -233,6 +239,11 @@ "resolved": "https://registry.npmjs.org/vscode-languageserver-types/-/vscode-languageserver-types-3.17.2.tgz", "integrity": "sha512-zHhCWatviizPIq9B7Vh9uvrH6x3sK8itC84HkamnBWoDFJtzBf7SWlpLCZUit72b3os45h6RWQNC9xHRDF8dRA==" }, + "vscode-uri": { + "version": "3.0.8", + "resolved": "https://registry.npmjs.org/vscode-uri/-/vscode-uri-3.0.8.tgz", + "integrity": "sha512-AyFQ0EVmsOZOlAnxoFOGOq1SQDWAB7C6aqMGS23svWAllfOaxbuFvcT8D1i8z3Gyn8fraVeZNNmN6e9bxxXkKw==" + }, "ws": { "version": "8.11.0", "resolved": "https://registry.npmjs.org/ws/-/ws-8.11.0.tgz", diff --git a/server/package.json b/server/package.json index b4b45e9c..e867f366 100644 --- a/server/package.json +++ b/server/package.json @@ -16,6 +16,7 @@ "portfinder": "^1.0.32", "vscode-languageserver": "^8.0.2", "vscode-languageserver-textdocument": "^1.0.8", + "vscode-uri": "^3.0.8", "ws": "^8.11.0" }, "devDependencies": { diff --git a/server/src/engine/flix.ts b/server/src/engine/flix.ts index e0ff378c..63f1ce11 100644 --- a/server/src/engine/flix.ts +++ b/server/src/engine/flix.ts @@ -20,6 +20,7 @@ import javaVersion from '../util/javaVersion' import { ChildProcess, spawn } from 'child_process' import { getPortPromise } from 'portfinder' import * as _ from 'lodash' +import { URI } from 'vscode-uri' import * as jobs from './jobs' import * as queue from './queue' @@ -77,11 +78,7 @@ export function getExtensionVersion() { export function getProjectRootUri() { const path = _.first(startEngineInput.workspaceFolders)! - - // This is the format that that VSCode forwards the URI in - const escapedPath = path.replace(':', '%3A') - - return new URL(`file:///${escapedPath}`) + return URI.file(path) } export function updateUserConfiguration(userConfiguration: UserConfiguration) { diff --git a/server/src/handlers/handlers.ts b/server/src/handlers/handlers.ts index 830f3af2..4ab92ab5 100644 --- a/server/src/handlers/handlers.ts +++ b/server/src/handlers/handlers.ts @@ -35,6 +35,7 @@ import { USER_MESSAGE } from '../util/userMessages' import { StatusCode } from '../util/statusCodes' import _ = require('lodash/fp') +import { URI } from 'vscode-uri' interface UriInput { uri: string @@ -167,7 +168,7 @@ export function handleChangeContent(params: TextDocumentChangeEvent new RegExp(regExpString)) - return regExps.some(regExp => regExp.test(uri)) + + return pathRegExps.some(pathRegExp => pathRegExp.test(uri.path)) } /** From 60715aa77a5ce6a30d9139f302a4116245bf0fb8 Mon Sep 17 00:00:00 2001 From: sockmaster27 <61235930+sockmaster27@users.noreply.github.com> Date: Sat, 27 Jan 2024 20:56:34 +0100 Subject: [PATCH 07/12] chore: revert warning message --- server/src/handlers/handlers.ts | 1 - server/src/util/userMessages.ts | 4 ---- 2 files changed, 5 deletions(-) diff --git a/server/src/handlers/handlers.ts b/server/src/handlers/handlers.ts index 4ab92ab5..ac743190 100644 --- a/server/src/handlers/handlers.ts +++ b/server/src/handlers/handlers.ts @@ -169,7 +169,6 @@ export function handleChangeContent(params: TextDocumentChangeEvent Date: Sun, 28 Jan 2024 16:10:44 +0100 Subject: [PATCH 08/12] refactor: introduce `currentWorkspaceFiles` --- server/package-lock.json | 11 --------- server/package.json | 1 - server/src/engine/flix.ts | 40 +++++++++++++++++++++++++++----- server/src/handlers/handlers.ts | 41 ++------------------------------- 4 files changed, 36 insertions(+), 57 deletions(-) diff --git a/server/package-lock.json b/server/package-lock.json index d65cb4e3..c8d74711 100644 --- a/server/package-lock.json +++ b/server/package-lock.json @@ -13,7 +13,6 @@ "portfinder": "^1.0.32", "vscode-languageserver": "^8.0.2", "vscode-languageserver-textdocument": "^1.0.8", - "vscode-uri": "^3.0.8", "ws": "^8.11.0" }, "devDependencies": { @@ -125,11 +124,6 @@ "resolved": "https://registry.npmjs.org/vscode-languageserver-types/-/vscode-languageserver-types-3.17.2.tgz", "integrity": "sha512-zHhCWatviizPIq9B7Vh9uvrH6x3sK8itC84HkamnBWoDFJtzBf7SWlpLCZUit72b3os45h6RWQNC9xHRDF8dRA==" }, - "node_modules/vscode-uri": { - "version": "3.0.8", - "resolved": "https://registry.npmjs.org/vscode-uri/-/vscode-uri-3.0.8.tgz", - "integrity": "sha512-AyFQ0EVmsOZOlAnxoFOGOq1SQDWAB7C6aqMGS23svWAllfOaxbuFvcT8D1i8z3Gyn8fraVeZNNmN6e9bxxXkKw==" - }, "node_modules/ws": { "version": "8.11.0", "resolved": "https://registry.npmjs.org/ws/-/ws-8.11.0.tgz", @@ -239,11 +233,6 @@ "resolved": "https://registry.npmjs.org/vscode-languageserver-types/-/vscode-languageserver-types-3.17.2.tgz", "integrity": "sha512-zHhCWatviizPIq9B7Vh9uvrH6x3sK8itC84HkamnBWoDFJtzBf7SWlpLCZUit72b3os45h6RWQNC9xHRDF8dRA==" }, - "vscode-uri": { - "version": "3.0.8", - "resolved": "https://registry.npmjs.org/vscode-uri/-/vscode-uri-3.0.8.tgz", - "integrity": "sha512-AyFQ0EVmsOZOlAnxoFOGOq1SQDWAB7C6aqMGS23svWAllfOaxbuFvcT8D1i8z3Gyn8fraVeZNNmN6e9bxxXkKw==" - }, "ws": { "version": "8.11.0", "resolved": "https://registry.npmjs.org/ws/-/ws-8.11.0.tgz", diff --git a/server/package.json b/server/package.json index e867f366..b4b45e9c 100644 --- a/server/package.json +++ b/server/package.json @@ -16,7 +16,6 @@ "portfinder": "^1.0.32", "vscode-languageserver": "^8.0.2", "vscode-languageserver-textdocument": "^1.0.8", - "vscode-uri": "^3.0.8", "ws": "^8.11.0" }, "devDependencies": { diff --git a/server/src/engine/flix.ts b/server/src/engine/flix.ts index 63f1ce11..53e33193 100644 --- a/server/src/engine/flix.ts +++ b/server/src/engine/flix.ts @@ -20,7 +20,6 @@ import javaVersion from '../util/javaVersion' import { ChildProcess, spawn } from 'child_process' import { getPortPromise } from 'portfinder' import * as _ from 'lodash' -import { URI } from 'vscode-uri' import * as jobs from './jobs' import * as queue from './queue' @@ -63,6 +62,7 @@ export interface StartEngineInput { let flixInstance: ChildProcess | undefined = undefined let startEngineInput: StartEngineInput let flixRunning: boolean = false +let currentWorkspaceFiles: Set = new Set() export function isRunning() { return flixRunning @@ -76,11 +76,6 @@ export function getExtensionVersion() { return _.get(startEngineInput, 'extensionVersion', '(unknown version)') } -export function getProjectRootUri() { - const path = _.first(startEngineInput.workspaceFolders)! - return URI.file(path) -} - export function updateUserConfiguration(userConfiguration: UserConfiguration) { _.set(userConfiguration, 'userConfiguration', startEngineInput) queue.resetEnqueueDebounced() @@ -108,6 +103,8 @@ export async function start(input: StartEngineInput) { const { flixFilename, extensionPath, workspaceFiles, workspacePkgs, workspaceJars } = input + currentWorkspaceFiles = new Set(workspaceFiles) + // Check for valid Java version const { majorVersion, versionString } = await javaVersion(extensionPath) if (versionString === undefined) { @@ -204,7 +201,12 @@ export async function stop() { } } +/** + * Add the given `uri` to the workspace. + */ export function addUri(uri: string) { + currentWorkspaceFiles.add(uri) + const job: jobs.Job = { request: jobs.Request.apiAddUri, uri, @@ -212,7 +214,33 @@ export function addUri(uri: string) { queue.enqueue(job) } +/** + * Handle a change in the file with the given `uri`. + * + * If this URI has not already been added to the workspace via {@linkcode addUri}, + * it will be ignored, making it safe to call this function on any file. + */ +export function updateUri(uri: string) { + if (!currentWorkspaceFiles.has(uri)) { + return + } + + const job: jobs.Job = { + request: jobs.Request.apiAddUri, + uri, + } + + // Skip the delay to improve auto-complete responsiveness + const skipDelay = true + queue.enqueue(job, skipDelay) +} + +/** + * Remove the given `uri` from the workspace. + */ export function remUri(uri: string) { + currentWorkspaceFiles.delete(uri) + const job: jobs.Job = { request: jobs.Request.apiRemUri, uri, diff --git a/server/src/handlers/handlers.ts b/server/src/handlers/handlers.ts index ac743190..33d7158e 100644 --- a/server/src/handlers/handlers.ts +++ b/server/src/handlers/handlers.ts @@ -24,18 +24,15 @@ import { import { TextDocument } from 'vscode-languageserver-textdocument' import * as jobs from '../engine/jobs' -import * as queue from '../engine/queue' import * as engine from '../engine' import * as socket from '../engine/socket' import { clearDiagnostics, sendDiagnostics, sendNotification } from '../server' import { makePositionalHandler, makeEnqueuePromise, enqueueUnlessHasErrors, makeDefaultResponseHandler } from './util' -import { getProjectRootUri } from '../engine' import { USER_MESSAGE } from '../util/userMessages' import { StatusCode } from '../util/statusCodes' import _ = require('lodash/fp') -import { URI } from 'vscode-uri' interface UriInput { uri: string @@ -156,50 +153,16 @@ export function handleExit() { export function handleSave(params: TextDocumentChangeEvent) { if (engine.compileOnSaveEnabled()) { - addUriToCompiler(params.document, true) + engine.updateUri(params.document.uri) } } export function handleChangeContent(params: TextDocumentChangeEvent) { if (engine.compileOnChangeEnabled()) { - // We send the document immediately to ensure better auto-complete. - addUriToCompiler(params.document, true) + engine.updateUri(params.document.uri) } } -function addUriToCompiler(document: TextDocument, skipDelay?: boolean) { - if (!uriIsInProject(URI.parse(document.uri))) { - return - } - - const job: jobs.Job = { - request: jobs.Request.apiAddUri, - uri: document.uri, // Note: this typically has the file:// scheme (important for files as keys) - src: document.getText(), - } - queue.enqueue(job, skipDelay) -} - -function uriIsInProject(uri: URI) { - const rootUri = getProjectRootUri() - - if (rootUri.scheme !== uri.scheme) { - return false - } - - if (rootUri.authority !== uri.authority) { - return false - } - - const pathRegExps = [ - String.raw`^${rootUri.path}/[^/]*\.flix$`, - String.raw`^${rootUri.path}/src/.*\.flix$`, - String.raw`^${rootUri.path}/test/.*\.flix$`, - ].map(regExpString => new RegExp(regExpString)) - - return pathRegExps.some(pathRegExp => pathRegExp.test(uri.path)) -} - /** * @function */ From 7a677d606fe5e37fe518e5124d37a1be4b7afc59 Mon Sep 17 00:00:00 2001 From: sockmaster27 <61235930+sockmaster27@users.noreply.github.com> Date: Sun, 28 Jan 2024 16:15:41 +0100 Subject: [PATCH 09/12] fix: workaround for cyclic dependency --- server/src/handlers/handlers.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/server/src/handlers/handlers.ts b/server/src/handlers/handlers.ts index 33d7158e..d804b72f 100644 --- a/server/src/handlers/handlers.ts +++ b/server/src/handlers/handlers.ts @@ -23,6 +23,10 @@ import { } from 'vscode-languageserver' import { TextDocument } from 'vscode-languageserver-textdocument' +// Workaround for circular dependency between flix.ts and queue.ts +import * as queue from '../engine/queue' +queue.enqueue + import * as jobs from '../engine/jobs' import * as engine from '../engine' import * as socket from '../engine/socket' From e9d3d86bee7fb7973b8f44bda02b94ee04127022 Mon Sep 17 00:00:00 2001 From: sockmaster27 <61235930+sockmaster27@users.noreply.github.com> Date: Sun, 28 Jan 2024 16:28:57 +0100 Subject: [PATCH 10/12] fix: include source code in `updateUri` --- server/src/engine/flix.ts | 4 +++- server/src/handlers/handlers.ts | 6 ++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/server/src/engine/flix.ts b/server/src/engine/flix.ts index 53e33193..6914b85a 100644 --- a/server/src/engine/flix.ts +++ b/server/src/engine/flix.ts @@ -220,14 +220,16 @@ export function addUri(uri: string) { * If this URI has not already been added to the workspace via {@linkcode addUri}, * it will be ignored, making it safe to call this function on any file. */ -export function updateUri(uri: string) { +export function updateUri(uri: string, src: string) { if (!currentWorkspaceFiles.has(uri)) { return } + // Including the source code in the job is necessary because the file might not yet have been saved const job: jobs.Job = { request: jobs.Request.apiAddUri, uri, + src, } // Skip the delay to improve auto-complete responsiveness diff --git a/server/src/handlers/handlers.ts b/server/src/handlers/handlers.ts index d804b72f..2738b4df 100644 --- a/server/src/handlers/handlers.ts +++ b/server/src/handlers/handlers.ts @@ -157,13 +157,15 @@ export function handleExit() { export function handleSave(params: TextDocumentChangeEvent) { if (engine.compileOnSaveEnabled()) { - engine.updateUri(params.document.uri) + const document = params.document + engine.updateUri(document.uri, document.getText()) } } export function handleChangeContent(params: TextDocumentChangeEvent) { if (engine.compileOnChangeEnabled()) { - engine.updateUri(params.document.uri) + const document = params.document + engine.updateUri(document.uri, document.getText()) } } From 01ea094b853d8054f0910c7fa0fe23ec51b4200c Mon Sep 17 00:00:00 2001 From: sockmaster27 <61235930+sockmaster27@users.noreply.github.com> Date: Sun, 28 Jan 2024 16:37:25 +0100 Subject: [PATCH 11/12] refactor: move circular dependency workaround --- server/src/handlers/handlers.ts | 4 ---- server/src/server.ts | 5 +++++ 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/server/src/handlers/handlers.ts b/server/src/handlers/handlers.ts index 2738b4df..43ee0fe7 100644 --- a/server/src/handlers/handlers.ts +++ b/server/src/handlers/handlers.ts @@ -23,10 +23,6 @@ import { } from 'vscode-languageserver' import { TextDocument } from 'vscode-languageserver-textdocument' -// Workaround for circular dependency between flix.ts and queue.ts -import * as queue from '../engine/queue' -queue.enqueue - import * as jobs from '../engine/jobs' import * as engine from '../engine' import * as socket from '../engine/socket' diff --git a/server/src/server.ts b/server/src/server.ts index 74b2ce82..68ec9dc0 100644 --- a/server/src/server.ts +++ b/server/src/server.ts @@ -2,6 +2,11 @@ import { createConnection, TextDocuments, ProposedFeatures, PublishDiagnosticsPa import { TextDocument } from 'vscode-languageserver-textdocument' +// Workaround for circular dependency between flix.ts and queue.ts +// TODO: Fix this +import * as queue from './engine/queue' +queue + import * as handlers from './handlers' import * as jobs from './engine/jobs' From 5d6cc35c07177a707fa5dcde5c21c304d30104b4 Mon Sep 17 00:00:00 2001 From: sockmaster27 <61235930+sockmaster27@users.noreply.github.com> Date: Sun, 28 Jan 2024 16:43:13 +0100 Subject: [PATCH 12/12] chore: correct comment --- server/src/engine/flix.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/src/engine/flix.ts b/server/src/engine/flix.ts index 6914b85a..5976ea49 100644 --- a/server/src/engine/flix.ts +++ b/server/src/engine/flix.ts @@ -232,7 +232,7 @@ export function updateUri(uri: string, src: string) { src, } - // Skip the delay to improve auto-complete responsiveness + // Skip the delay to make auto-complete work const skipDelay = true queue.enqueue(job, skipDelay) }