1+ import { IToken } from 'chevrotain' ;
2+ import * as path from 'path' ;
3+ import { URL } from 'url' ;
14import {
5+ CompletionItem ,
26 createConnection ,
3- TextDocuments ,
4- TextDocument ,
5- ProposedFeatures ,
6- InitializeParams ,
77 DidChangeConfigurationNotification ,
8- CompletionItem ,
98 Hover ,
9+ InitializeParams ,
10+ ProposedFeatures ,
11+ TextDocument ,
12+ TextDocuments ,
1013 WorkspaceFolder
1114} from 'vscode-languageserver' ;
12- import { ZSLexer } from './parser/zsLexer ' ;
13- import { IToken } from 'chevrotain ' ;
14- import { ZenScriptParser } from './parser/zsParser ' ;
15+ import Uri from 'vscode-uri ' ;
16+ import { zGlobal } from './api/global ' ;
17+ import { defaultSettings , ZenScriptSettings } from './api/setting ' ;
1518import {
19+ BracketHandlerMap ,
1620 DetailBracketHandlers ,
17- SimpleBracketHandlers ,
18- BracketHandlerMap
21+ SimpleBracketHandlers
1922} from './completion/bracketHandler/bracketHandlers' ;
2023import { Keywords , Preprocessors } from './completion/completion' ;
21- import { URL } from 'url' ;
22- import { zGlobal } from './api/global' ;
23- import { ZenScriptSettings , defaultSettings } from './api/setting' ;
24+ import { ZSLexer } from './parser/zsLexer' ;
2425import { applyRequests } from './requests/requests' ;
25- import { reloadRCFile } from './utils/zsrcFile' ;
2626import { findToken } from './utils/findToken' ;
27+ import { reloadRCFile } from './utils/zsrcFile' ;
2728
2829// 创建一个服务的连接,连接使用 Node 的 IPC 作为传输
2930// 并且引入所有 LSP 特性, 包括 preview / proposed
@@ -44,7 +45,14 @@ connection.onInitialize((params: InitializeParams) => {
4445 // disable most of language server features
4546 // TODO: Make it available for workspace
4647 let folder : WorkspaceFolder | undefined = undefined ;
47- folders . forEach ( f => ( folder = f . name === 'scripts' ? f : undefined ) ) ;
48+ folders . forEach (
49+ f =>
50+ ( folder =
51+ f . name === 'scripts' ||
52+ path . basename ( Uri . parse ( f . uri ) . fsPath ) === 'scripts'
53+ ? f
54+ : undefined )
55+ ) ;
4856
4957 // whether a folder named `scripts` exist
5058 if ( folder ) {
0 commit comments