-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
support some variables in config (fixes #35)
- Loading branch information
Sander Ronde
committed
Jul 5, 2023
1 parent
923aa24
commit db2c982
Showing
4 changed files
with
20 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import type { ClassConfig } from './phpstan/manager'; | ||
|
||
export function replaceVariables(str: string, config: ClassConfig): string { | ||
return str.replace(/\${workspaceFolder}/g, () => { | ||
const workspaceFolder = config.getWorkspaceFolder(); | ||
if (!workspaceFolder) { | ||
throw new Error( | ||
'workspaceFolder is not set but is used in a variable' | ||
); | ||
} | ||
return workspaceFolder.fsPath; | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters