Skip to content

Commit

Permalink
Detect real folder name & workspace folder name.
Browse files Browse the repository at this point in the history
  • Loading branch information
Yesterday17 committed Jan 23, 2019
1 parent 4ce50ff commit 9bf0a3f
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 16 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@
},
"scripts": {
"vscode:prepublish": "yarn run update-vscode && yarn run compile",
"debug-package": "yarn version --patch && vsce package",
"debug-package": "yarn version --no-git-tag-version --patch && vsce package",
"update-vscode": "vscode-install",
"postinstall": "vscode-install",
"compile": "tsc -b",
Expand Down
38 changes: 23 additions & 15 deletions server/server.ts
Original file line number Diff line number Diff line change
@@ -1,29 +1,30 @@
import { IToken } from 'chevrotain';
import * as path from 'path';
import { URL } from 'url';
import {
CompletionItem,
createConnection,
TextDocuments,
TextDocument,
ProposedFeatures,
InitializeParams,
DidChangeConfigurationNotification,
CompletionItem,
Hover,
InitializeParams,
ProposedFeatures,
TextDocument,
TextDocuments,
WorkspaceFolder
} from 'vscode-languageserver';
import { ZSLexer } from './parser/zsLexer';
import { IToken } from 'chevrotain';
import { ZenScriptParser } from './parser/zsParser';
import Uri from 'vscode-uri';
import { zGlobal } from './api/global';
import { defaultSettings, ZenScriptSettings } from './api/setting';
import {
BracketHandlerMap,
DetailBracketHandlers,
SimpleBracketHandlers,
BracketHandlerMap
SimpleBracketHandlers
} from './completion/bracketHandler/bracketHandlers';
import { Keywords, Preprocessors } from './completion/completion';
import { URL } from 'url';
import { zGlobal } from './api/global';
import { ZenScriptSettings, defaultSettings } from './api/setting';
import { ZSLexer } from './parser/zsLexer';
import { applyRequests } from './requests/requests';
import { reloadRCFile } from './utils/zsrcFile';
import { findToken } from './utils/findToken';
import { reloadRCFile } from './utils/zsrcFile';

// 创建一个服务的连接,连接使用 Node 的 IPC 作为传输
// 并且引入所有 LSP 特性, 包括 preview / proposed
Expand All @@ -44,7 +45,14 @@ connection.onInitialize((params: InitializeParams) => {
// disable most of language server features
// TODO: Make it available for workspace
let folder: WorkspaceFolder | undefined = undefined;
folders.forEach(f => (folder = f.name === 'scripts' ? f : undefined));
folders.forEach(
f =>
(folder =
f.name === 'scripts' ||
path.basename(Uri.parse(f.uri).fsPath) === 'scripts'
? f
: undefined)
);

// whether a folder named `scripts` exist
if (folder) {
Expand Down

0 comments on commit 9bf0a3f

Please sign in to comment.