Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add "ignore standalone" option that disables HLS for files that don't belong to any folder #353

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,12 @@
"default": "",
"description": "Manually set a language server executable. Can be something on the $PATH or a path to an executable itself. Works with ~, ${HOME} and ${workspaceFolder}."
},
"haskell.ignoreStandalone": {
"scope": "resource",
"type": "boolean",
"default": false,
"description": "Don't spawn language servers for stand-alone files (i.e. files that don't belong to any folder)"
},
"haskell.updateBehavior": {
"scope": "machine",
"type": "string",
Expand Down
3 changes: 2 additions & 1 deletion src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,9 @@ async function activeServer(context: ExtensionContext, document: TextDocument) {
}

async function activateServerForFolder(context: ExtensionContext, uri: Uri, folder?: WorkspaceFolder) {
const ignoreStandalone = workspace.getConfiguration('haskell').ignoreStandalone;
const clientsKey = folder ? folder.uri.toString() : uri.toString();

if (!folder && ignoreStandalone) return;
// If the client already has an LSP server for this uri/folder, then don't start a new one.
if (clients.has(clientsKey)) {
return;
Expand Down