Skip to content

Commit

Permalink
Add serverArgs (#73)
Browse files Browse the repository at this point in the history
  • Loading branch information
josephsumabat authored Dec 6, 2024
2 parents 0cdb6c6 + 5a21299 commit 8ce931d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { IHierarchicalOutputChannel } from './utils'
* The client launches its own server in a child process and cleans up after itself.
*/
export function makeClient(output: IHierarchicalOutputChannel, config: LanguageConfig): vscode.Disposable {
const { languageId, serverCommand } = config
const { languageId, serverCommand, serverArgs } = config
if (!languageId || !serverCommand) return vscode.Disposable.from()

const serverExecutable = {
Expand All @@ -18,7 +18,7 @@ export function makeClient(output: IHierarchicalOutputChannel, config: LanguageC
cwd: vscode.workspace.workspaceFolders?.[0].uri.fsPath,
env: process.env
},
args: [],
args: serverArgs || [],
transport: lsp.TransportKind.stdio
}

Expand Down
7 changes: 7 additions & 0 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,11 @@ export type LanguageConfig = {
*/
serverCommand?: string

/**
* A list of arguments passed to the `serverCommand`.
*/
serverArgs?: string[],

/**
* A formatter shell command.
* STDIN will be equal to the contents of the current text document,
Expand Down Expand Up @@ -265,6 +270,7 @@ export namespace Config {

lang.languageId = lang.languageId.trim()
lang.serverCommand = lang.serverCommand?.trim()
lang.serverArgs = lang.serverArgs?.map(arg => arg.trim())
lang.formatCommand = lang.formatCommand?.trim()
lang.onSaveCommand = lang.onSaveCommand?.trim()
lang.apiSearchUrl = lang.apiSearchUrl?.trim()
Expand Down Expand Up @@ -310,6 +316,7 @@ export namespace Config {
return {
languageId: mask.languageId,
serverCommand: mask.serverCommand || base.serverCommand,
serverArgs: mask.serverArgs || base.serverArgs,
formatCommand: mask.formatCommand || base.formatCommand,
apiSearchUrl: mask.apiSearchUrl || base.apiSearchUrl,
tags: arrayMerge(mask.tags || [], base.tags || [], tag => tag.file, tagMerge),
Expand Down

0 comments on commit 8ce931d

Please sign in to comment.