Fix bug and stop suggesting WorkspaceFolder as ConfigLocation (#119)

feature/search
Kelvin Schoofs 6 years ago
parent 6680c08209
commit 517a31301e

@ -206,8 +206,8 @@ export async function alterConfigs(location: ConfigLocation, alterer: ConfigAlte
case vscode.ConfigurationTarget.WorkspaceFolder:
const conf = vscode.workspace.getConfiguration('sshfs');
const inspect = conf.inspect<FileSystemConfig[]>('configs')!;
const array = [[], inspect.globalValue, inspect.workspaceValue, inspect.workspaceFolderValue][location];
if (!array) throw new Error(`Something very unexpected happened...`);
// If the array doesn't exist, create a new empty one
const array = [, inspect.globalValue, inspect.workspaceValue, inspect.workspaceFolderValue][location] || [];
let modified = alterer(array);
if (!modified) return;
modified = modified.map((config) => {

@ -17,7 +17,8 @@ export function formatConfigLocation(location?: ConfigLocation): string {
}
export function getLocations(configs: FileSystemConfig[]): ConfigLocation[] {
const res: ConfigLocation[] = [1, 2, 3];
const res: ConfigLocation[] = [1, 2 /*, 3*/]; // No WorkspaceFolder support (for now)
// TODO: Suggest creating sshfs.jsonc etc in current workspace folder(s) (UI feature?)
for (const { _location } of configs) {
if (!_location) continue;
if (!res.find(l => l === _location)) {

Loading…
Cancel
Save