diff --git a/packages/lib/server/VDF/Popfile/PopfileLanguageServer.ts b/packages/lib/server/VDF/Popfile/PopfileLanguageServer.ts index 63f527b3..7d378aa3 100644 --- a/packages/lib/server/VDF/Popfile/PopfileLanguageServer.ts +++ b/packages/lib/server/VDF/Popfile/PopfileLanguageServer.ts @@ -13,6 +13,9 @@ export class PopfileLanguageServer extends VDFLanguageServer { constructor(name: PopfileLanguageServer["name"], languageId: PopfileLanguageServer["languageId"], connection: Connection) { super(name, languageId, connection, { + getVDFTokeniserOptions(uri) { + return { allowMultilineStrings: true } + }, vpkRootPath: "scripts/population", keyHash: (key) => key, schema: { diff --git a/packages/lib/server/VDF/VDFLanguageServer.ts b/packages/lib/server/VDF/VDFLanguageServer.ts index 2acb8c09..e10f44c1 100644 --- a/packages/lib/server/VDF/VDFLanguageServer.ts +++ b/packages/lib/server/VDF/VDFLanguageServer.ts @@ -34,7 +34,7 @@ export abstract class VDFLanguageServer extends LanguageServer getVDFDocumentSymbols(str), + parseDocumentSymbols: (uri, str) => getVDFDocumentSymbols(str, this.VDFLanguageServerConfiguration.getVDFTokeniserOptions(uri)), defaultDocumentSymbols: () => new VDFDocumentSymbols() }) diff --git a/packages/lib/server/VDF/VDFLanguageServerConfiguration.ts b/packages/lib/server/VDF/VDFLanguageServerConfiguration.ts index 9d94f722..64a3d963 100644 --- a/packages/lib/server/VDF/VDFLanguageServerConfiguration.ts +++ b/packages/lib/server/VDF/VDFLanguageServerConfiguration.ts @@ -1,9 +1,11 @@ import type { languageClientsInfo } from "lib/languageClientsInfo" import type { DocumentLinkData } from "lib/types/DocumentLinkData" import type { VDFDocumentSymbol } from "lib/VDFDocumentSymbols/VDFDocumentSymbol" +import type { VDFTokeniserOptions } from "packages/lib/VDF/VDFTokeniserOptions" import type { Color, CompletionItem, DocumentLink } from "vscode-languageserver" export interface VDFLanguageServerConfiguration { + getVDFTokeniserOptions(uri: string): VDFTokeniserOptions, servers?: (keyof typeof languageClientsInfo)[] vpkRootPath?: string keyHash(key: string): string diff --git a/packages/lib/server/VDF/VGUI/VGUILanguageServer.ts b/packages/lib/server/VDF/VGUI/VGUILanguageServer.ts index fe18a88f..62e88319 100644 --- a/packages/lib/server/VDF/VGUI/VGUILanguageServer.ts +++ b/packages/lib/server/VDF/VGUI/VGUILanguageServer.ts @@ -9,6 +9,7 @@ import * as filesCompletion from "lib/utils/filesCompletion" import { getHUDRoot } from "lib/utils/getHUDRoot" import { normalizeUri } from "lib/utils/normalizeUri" import { posix } from "path" +import { basename } from "path/posix" import { CodeLens, Color, CompletionItem, CompletionItemKind, Diagnostic, DiagnosticSeverity, DocumentLink, Location, Range, type CodeLensParams, type CompletionParams, type Connection, type Definition, type DefinitionParams, type PrepareRenameParams, type ReferenceParams, type TextDocumentChangeEvent } from "vscode-languageserver" import type { TextDocument } from "vscode-languageserver-textdocument" import { z } from "zod" @@ -63,6 +64,11 @@ export class VGUILanguageServer extends VDFLanguageServer { constructor(name: VGUILanguageServer["name"], languageId: VGUILanguageServer["languageId"], connection: Connection) { super(name, languageId, connection, { + getVDFTokeniserOptions: (uri) => { + return { + allowMultilineStrings: /(tf|chat)_.*?\.txt/.test(basename(uri)) + } + }, servers: ["hudanimations"], keyHash: (key) => { return key.replace("_minmode", "") diff --git a/packages/lib/server/VDF/VMT/VMTLanguageServer.ts b/packages/lib/server/VDF/VMT/VMTLanguageServer.ts index ca894d42..9969d417 100644 --- a/packages/lib/server/VDF/VMT/VMTLanguageServer.ts +++ b/packages/lib/server/VDF/VMT/VMTLanguageServer.ts @@ -17,6 +17,9 @@ export class VMTLanguageServer extends VDFLanguageServer { constructor(name: VMTLanguageServer["name"], languageId: VMTLanguageServer["languageId"], connection: Connection) { super(name, languageId, connection, { + getVDFTokeniserOptions(uri) { + return { allowMultilineStrings: false } + }, keyHash: (key) => key, schema: { keys: keys,