diff --git a/packages/cursorless-jetbrains/package.json b/packages/cursorless-jetbrains/package.json index 74eebe6919..9420936128 100644 --- a/packages/cursorless-jetbrains/package.json +++ b/packages/cursorless-jetbrains/package.json @@ -32,10 +32,12 @@ "@cursorless/common": "workspace:*", "@cursorless/cursorless-engine": "workspace:*", "@cursorless/test-case-recorder": "workspace:*", + "lodash-es": "^4.17.21", "vscode-uri": "^3.0.8", "web-tree-sitter": "0.24.4" }, "devDependencies": { - "@types/chai": "^5.0.0" + "@types/chai": "^5.0.0", + "@types/lodash-es": "4.17.12" } } diff --git a/packages/cursorless-jetbrains/src/ide/JetbrainsConfiguration.ts b/packages/cursorless-jetbrains/src/ide/JetbrainsConfiguration.ts index 2cdffe861b..3c8ebf6d72 100644 --- a/packages/cursorless-jetbrains/src/ide/JetbrainsConfiguration.ts +++ b/packages/cursorless-jetbrains/src/ide/JetbrainsConfiguration.ts @@ -1,4 +1,3 @@ -import { get } from "lodash"; import type { Configuration, ConfigurationScope, @@ -7,6 +6,7 @@ import type { import { CONFIGURATION_DEFAULTS } from "@cursorless/common"; import type { GetFieldType, Paths } from "@cursorless/common"; import { Notifier } from "@cursorless/common"; +import { get } from "lodash-es"; export class JetbrainsConfiguration implements Configuration { private notifier = new Notifier(); @@ -18,7 +18,7 @@ export class JetbrainsConfiguration implements Configuration { getOwnConfiguration>( path: Path, - scope?: ConfigurationScope, + _scope?: ConfigurationScope, ): GetFieldType { return get(this.configuration, path) as GetFieldType< CursorlessConfiguration, @@ -33,41 +33,3 @@ export class JetbrainsConfiguration implements Configuration { this.notifier.notifyListeners(); } } - -export function createJetbrainsConfiguration( - configuration: CursorlessConfiguration, -): JetbrainsConfiguration { - return new JetbrainsConfiguration(configuration); -} - -/** - * Gets a configuration value from jetbrains, with supported variables expanded. - * For example, `${userHome}` will be expanded to the user's home directory. - * - * We currently only support `${userHome}`. - * - * @param path The path to the configuration value, eg `cursorless.snippetsDir` - * @returns The configuration value, with variables expanded, or undefined if - * the value is not set - */ -export function jetbrainsGetConfigurationString( - path: string, -): string | undefined { - const index = path.lastIndexOf("."); - const section = path.substring(0, index); - const field = path.substring(index + 1); - // const value = "jetbrains.workspace.getConfiguration(section).get(field)"; - // return value != null ? evaluateStringVariables(value) : undefined; - return undefined; -} - -function evaluateStringVariables(value: string): string { - return value.replace(/\${(\w+)}/g, (match, variable) => { - switch (variable) { - case "userHome": - return "~/"; - default: - throw Error(`Unknown jetbrains configuration variable '${variable}'`); - } - }); -} diff --git a/packages/cursorless-jetbrains/src/ide/JetbrainsIDE.ts b/packages/cursorless-jetbrains/src/ide/JetbrainsIDE.ts index 448945b421..15bd80060c 100644 --- a/packages/cursorless-jetbrains/src/ide/JetbrainsIDE.ts +++ b/packages/cursorless-jetbrains/src/ide/JetbrainsIDE.ts @@ -17,7 +17,7 @@ import type { TextEditor, WorkspaceFolder, } from "@cursorless/common"; -import { pull } from "lodash"; +import { pull } from "lodash-es"; import { JetbrainsCapabilities } from "./JetbrainsCapabilities"; import { fromJetbrainsContentChange } from "./JetbrainsEvents"; diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index ece52e246a..186e2557f8 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -386,6 +386,9 @@ importers: '@cursorless/test-case-recorder': specifier: workspace:* version: link:../test-case-recorder + lodash-es: + specifier: ^4.17.21 + version: 4.17.21 vscode-uri: specifier: ^3.0.8 version: 3.0.8 @@ -396,6 +399,9 @@ importers: '@types/chai': specifier: ^5.0.0 version: 5.0.0 + '@types/lodash-es': + specifier: 4.17.12 + version: 4.17.12 packages/cursorless-neovim: dependencies: