-
-
Notifications
You must be signed in to change notification settings - Fork 371
Add a strategy conf option allow workspace selection #1562
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
base: dev
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -980,6 +980,16 @@ | |||||
| "type": "boolean", | ||||||
| "description": "Display connections in two groups, 'Connected' and 'Not Connected'.", | ||||||
| "default": false | ||||||
| }, | ||||||
| "sqltools.strategy": { | ||||||
| "type": "string", | ||||||
| "enum": [ | ||||||
| "auto", | ||||||
| "global", | ||||||
| "workspace" | ||||||
| ], | ||||||
| "default": "auto", | ||||||
| "description": "SQLTools configuration strategy. 'auto' will use workspace settings if a workspace is open, and global settings otherwise. 'global' and 'workspace' will force the usage of global or workspace settings respectively." | ||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| } | ||||||
| } | ||||||
| }, | ||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -480,11 +480,27 @@ export class ConnectionManagerPlugin implements IExtensionPlugin { | |||||
| log.warn('Nothing to do. No parameter received'); | ||||||
| return; | ||||||
| } | ||||||
| let target: ConfigurationTarget; | ||||||
| const strategy = Config.strategy || 'auto'; | ||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| if (!writeTo) { | ||||||
| switch (strategy) { | ||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| case 'global': | ||||||
| target = ConfigurationTarget.Global; | ||||||
| break; | ||||||
| case 'workspace': | ||||||
| target = ConfigurationTarget.Workspace; | ||||||
| break; | ||||||
| default: | ||||||
| target = workspace.workspaceFolders ? ConfigurationTarget.Workspace : ConfigurationTarget.Global; | ||||||
| } | ||||||
| } else { | ||||||
| target = ConfigurationTarget[writeTo]; | ||||||
| } | ||||||
|
|
||||||
| const connList = this.getConnectionList(ConfigurationTarget[writeTo] || undefined); | ||||||
| const connList = this.getConnectionList(target || undefined); | ||||||
| this._throwIfNotUnique(connInfo, connList); | ||||||
| connList.push(connInfo); | ||||||
| return this.saveConnectionList(connList, ConfigurationTarget[writeTo]); | ||||||
| return this.saveConnectionList(connList, target); | ||||||
| } | ||||||
|
|
||||||
| private ext_updateConnection = (oldId: string, connInfo: IConnection, writeTo?: keyof typeof ConfigurationTarget) => { | ||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -823,6 +823,16 @@ export interface ISettings { | |||||
| debug?: { namespaces?: string }; | ||||||
|
|
||||||
| 'connectionExplorer.groupConnected'?: boolean; | ||||||
|
|
||||||
| /** | ||||||
| * SQLTools configuration strategy. | ||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| * 'auto' will use workspace settings if a workspace is open, and global settings otherwise. | ||||||
| * 'global' and 'workspace' will force the usage of global or workspace settings respectively. | ||||||
| * @type {string} | ||||||
| * @default 'auto' | ||||||
| * @memberof ISettings | ||||||
| */ | ||||||
| strategy?: 'auto' | 'global' | 'workspace'; | ||||||
| } | ||||||
|
|
||||||
| export interface IConfig extends ISettings { | ||||||
|
|
||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest we make the setting name more descriptive: