Skip to content

Commit

Permalink
fix(LanguageService): disallow symbols as uri
Browse files Browse the repository at this point in the history
  • Loading branch information
bhsd-harry committed Feb 6, 2025
1 parent 5920313 commit 1be53a6
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -332,5 +332,5 @@ export interface Parser {
* 创建语言服务
* @param uri 文档标识
*/
createLanguageService(uri: object | symbol): LanguageService;
createLanguageService(uri: object): LanguageService;
}
4 changes: 2 additions & 2 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ declare interface Parser extends ParserBase {
* 创建语言服务
* @param uri 文档标识
*/
createLanguageService(uri: object | symbol): LanguageService;
createLanguageService(uri: object): LanguageService;

/* NOT FOR BROWSER */

Expand Down Expand Up @@ -350,7 +350,7 @@ const Parser: Parser = { // eslint-disable-line @typescript-eslint/no-redeclare
},

/** @implements */
createLanguageService(uri: object | symbol) {
createLanguageService(uri: object) {
let mod: typeof import('./lib/lsp');
// eslint-disable-next-line no-unused-labels
LSP: mod = require('./lib/lsp');
Expand Down
4 changes: 2 additions & 2 deletions lib/lsp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ declare interface CompletionConfig {
params: string[];
}

export const tasks = new WeakMap<object | symbol, LanguageService>();
export const tasks = new WeakMap<object, LanguageService>();

const plainTypes = new Set<TokenTypes | 'text'>(['text', 'comment', 'noinclude', 'include']);

Expand Down Expand Up @@ -122,7 +122,7 @@ export class LanguageService implements LanguageServiceBase {
#completionConfig: CompletionConfig | undefined;

/** @param uri 任务标识 */
constructor(uri: object | symbol) {
constructor(uri: object) {
tasks.set(uri, this);
}

Expand Down

0 comments on commit 1be53a6

Please sign in to comment.