Skip to content

Commit 828b7a5

Browse files
authored
Port file dialog changes to release branch (#96)
* Add ability to only show folders in File Browser dialogs (#95) * Add built files
1 parent 0f07d03 commit 828b7a5

File tree

6 files changed

+121
-26
lines changed

6 files changed

+121
-26
lines changed

lib/main.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -925,8 +925,8 @@ class FileBrowserFeature extends SqlOpsFeature {
925925
}
926926
registerProvider(options) {
927927
const client = this._client;
928-
let openFileBrowser = (ownerUri, expandPath, fileFilters, changeFilter) => {
929-
let params = { ownerUri, expandPath, fileFilters, changeFilter };
928+
let openFileBrowser = (ownerUri, expandPath, fileFilters, changeFilter, showFoldersOnly) => {
929+
let params = { ownerUri, expandPath, fileFilters, changeFilter, showFoldersOnly };
930930
return client.sendRequest(protocol.FileBrowserOpenRequest.type, params).then(r => r, e => {
931931
client.logFailedRequest(protocol.FileBrowserOpenRequest.type, e);
932932
return Promise.resolve(undefined);

lib/types.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ export interface FileBrowserOpenParams {
121121
expandPath: string;
122122
fileFilters: string[];
123123
changeFilter: boolean;
124+
showFoldersOnly?: boolean;
124125
}
125126
export interface FileTreeNode {
126127
children: FileTreeNode[];

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "dataprotocol-client",
3-
"version": "1.3.6",
3+
"version": "1.3.8",
44
"description": "Client data protocol implementation for Azure Data Studio",
55
"main": "lib/main",
66
"typings": "lib/main",

src/azdata.proposed.d.ts

Lines changed: 114 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -661,12 +661,7 @@ declare module 'azdata' {
661661
type?: ExtensionNodeType;
662662
}
663663

664-
export interface AccountKey {
665-
/**
666-
* Auth Library used to add the account
667-
*/
668-
authLibrary?: string;
669-
}
664+
export interface Component extends vscode.Disposable { }
670665

671666
export namespace workspace {
672667
/**
@@ -694,6 +689,25 @@ declare module 'azdata' {
694689
headerFilter?: boolean,
695690
}
696691

692+
export type ExecutionPlanData = executionPlan.ExecutionPlanGraphInfo | executionPlan.ExecutionPlanGraph[];
693+
694+
export interface ExecutionPlanComponentProperties extends ComponentProperties {
695+
/**
696+
* Provide the execution plan file to be displayed. In case of execution plan graph info, the file type will determine the provider to be used to generate execution plan graphs
697+
*/
698+
data?: ExecutionPlanData;
699+
}
700+
701+
/**
702+
* Defines the executionPlan component
703+
*/
704+
export interface ExecutionPlanComponent extends Component, ExecutionPlanComponentProperties {
705+
}
706+
707+
export interface ModelBuilder {
708+
executionPlan(): ComponentBuilder<ExecutionPlanComponent, ExecutionPlanComponentProperties>;
709+
}
710+
697711
export interface ListViewOption {
698712
/**
699713
* The optional accessibility label for the column. Default is the label for the list view option.
@@ -853,18 +867,14 @@ declare module 'azdata' {
853867
* Whether to include the column headers.
854868
*/
855869
includeHeaders: boolean
856-
/**
857-
* Whether to remove line breaks from the cell value.
858-
*/
859-
removeNewLines: boolean;
860870
/**
861871
* The selected ranges to be copied.
862872
*/
863873
selections: SelectionRange[];
864874
}
865875

866876
export interface CopyResultsRequestResult {
867-
/**
877+
/**
868878
* Result string from copy operation
869879
*/
870880
results: string;
@@ -886,12 +896,19 @@ declare module 'azdata' {
886896

887897
export enum DataProviderType {
888898
TableDesignerProvider = 'TableDesignerProvider',
889-
ExecutionPlanProvider = 'ExecutionPlanProvider'
899+
ExecutionPlanProvider = 'ExecutionPlanProvider',
900+
ServerContextualizationProvider = 'ServerContextualizationProvider'
890901
}
891902

892903
export namespace dataprotocol {
893904
export function registerTableDesignerProvider(provider: designers.TableDesignerProvider): vscode.Disposable;
894905
export function registerExecutionPlanProvider(provider: executionPlan.ExecutionPlanProvider): vscode.Disposable;
906+
/**
907+
* Registers a server contextualization provider, which can provide context about a server to extensions like GitHub
908+
* Copilot for improved suggestions.
909+
* @param provider The provider to register
910+
*/
911+
export function registerServerContextualizationProvider(provider: contextualization.ServerContextualizationProvider): vscode.Disposable;
895912
}
896913

897914
export namespace designers {
@@ -900,8 +917,9 @@ declare module 'azdata' {
900917
* @param providerId The table designer provider Id.
901918
* @param tableInfo The table information. The object will be passed back to the table designer provider as the unique identifier for the table.
902919
* @param telemetryInfo Optional Key-value pair containing any extra information that needs to be sent via telemetry
920+
* @param objectExplorerContext Optional The context used to refresh Object Explorer after the table is created or edited
903921
*/
904-
export function openTableDesigner(providerId: string, tableInfo: TableInfo, telemetryInfo?: { [key: string]: string }): Thenable<void>;
922+
export function openTableDesigner(providerId: string, tableInfo: TableInfo, telemetryInfo?: { [key: string]: string }, objectExplorerContext?: ObjectExplorerContext): Thenable<void>;
905923

906924
/**
907925
* Definition for the table designer provider.
@@ -1771,6 +1789,23 @@ declare module 'azdata' {
17711789
}
17721790
}
17731791

1792+
export namespace contextualization {
1793+
export interface GetServerContextualizationResult {
1794+
/**
1795+
* The retrieved server context.
1796+
*/
1797+
context: string | undefined;
1798+
}
1799+
1800+
export interface ServerContextualizationProvider extends DataProvider {
1801+
/**
1802+
* Gets server context, which can be in the form of create scripts but is left up each provider.
1803+
* @param ownerUri The URI of the connection to get context for.
1804+
*/
1805+
getServerContextualization(ownerUri: string): Thenable<GetServerContextualizationResult>;
1806+
}
1807+
}
1808+
17741809
/**
17751810
* Component to display text with an icon representing the severity
17761811
*/
@@ -1824,14 +1859,21 @@ declare module 'azdata' {
18241859
/**
18251860
* Corresponds to the aria-live accessibility attribute for this component
18261861
*/
1827-
ariaLive?: AriaLiveValue
1862+
ariaLive?: AriaLiveValue;
18281863
}
18291864

18301865
export interface ContainerProperties extends ComponentProperties {
18311866
/**
18321867
* Corresponds to the aria-live accessibility attribute for this component
18331868
*/
1834-
ariaLive?: AriaLiveValue
1869+
ariaLive?: AriaLiveValue;
1870+
}
1871+
1872+
export interface DropDownProperties {
1873+
/**
1874+
* Whether or not an option in the list must be selected or a "new" option can be set. Only applicable when 'editable' is true. Default false.
1875+
*/
1876+
strictSelection?: boolean;
18351877
}
18361878

18371879
export interface NodeInfo {
@@ -1926,16 +1968,24 @@ declare module 'azdata' {
19261968
NotBetween = 7,
19271969
Contains = 8,
19281970
NotContains = 9,
1929-
IsNull = 10,
1930-
IsNotNull = 11
1971+
StartsWith = 10,
1972+
NotStartsWith = 11,
1973+
EndsWith = 12,
1974+
NotEndsWith = 13
19311975
}
19321976

1977+
export interface ModelView extends vscode.Disposable { }
1978+
1979+
export interface DeclarativeTableMenuCellValue extends vscode.Disposable { }
1980+
19331981
export namespace window {
1934-
export interface Wizard extends LoadingComponentBase {
1935-
}
1982+
export interface Wizard extends LoadingComponentBase { }
19361983

1937-
export interface Dialog extends LoadingComponentBase {
1938-
}
1984+
export interface Dialog extends LoadingComponentBase, vscode.Disposable { }
1985+
1986+
export interface ModelViewPanel extends vscode.Disposable { }
1987+
1988+
export interface ModelViewDashboard extends vscode.Disposable { }
19391989

19401990
/**
19411991
* Opens the error dialog with customization options provided.
@@ -2000,6 +2050,32 @@ declare module 'azdata' {
20002050
*/
20012051
isPrimary: boolean;
20022052
}
2053+
2054+
export interface FileFilters {
2055+
/**
2056+
* The label to display in the file filter field next to the list of filters.
2057+
*/
2058+
label: string;
2059+
/**
2060+
* The filters to limit what files are visible in the file browser (e.g. '*.sql' for SQL files).
2061+
*/
2062+
filters: string[];
2063+
}
2064+
2065+
/**
2066+
* Opens a dialog to select a file path on the specified server's machine. Note: The dialog for just browsing local
2067+
* files without any connection is opened via vscode.window.showOpenDialog.
2068+
* @param connectionUri The URI of the connection to the target server
2069+
* @param targetPath The file path on the server machine to open by default in the dialog
2070+
* @param fileFilters The filters used to limit which files are displayed in the file browser
2071+
* @param showFoldersOnly Optional argument to specify whether the browser should only show folders
2072+
* @returns The path of the file chosen from the dialog, and undefined if the dialog is closed without selecting anything.
2073+
*/
2074+
export function openServerFileBrowserDialog(connectionUri: string, targetPath: string, fileFilters: FileFilters[], showFoldersOnly?: boolean): Thenable<string | undefined>;
2075+
}
2076+
2077+
export interface FileBrowserProvider extends DataProvider {
2078+
openFileBrowser(ownerUri: string, expandPath: string, fileFilters: string[], changeFilter: boolean, showFoldersOnly?: boolean): Thenable<boolean>;
20032079
}
20042080

20052081
export interface TableComponent {
@@ -2008,4 +2084,21 @@ declare module 'azdata' {
20082084
*/
20092085
setActiveCell(row: number, column: number): void;
20102086
}
2087+
2088+
export interface ProfilerProvider {
2089+
startSession(sessionId: string, sessionName: string, sessionType?: ProfilingSessionType): Thenable<boolean>;
2090+
}
2091+
2092+
export enum ProfilingSessionType {
2093+
RemoteSession = 0,
2094+
LocalFile = 1
2095+
}
2096+
2097+
export interface SplitViewLayout extends FlexLayout {
2098+
/**
2099+
* SplitView size. Height if the orientation is vertical, width if the orientation is horizontal
2100+
* If undefined, the size of the model view container is used
2101+
*/
2102+
splitViewSize?: number | string | undefined;
2103+
}
20112104
}

src/main.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1267,8 +1267,8 @@ export class FileBrowserFeature extends SqlOpsFeature<undefined> {
12671267
protected registerProvider(options: undefined): Disposable {
12681268
const client = this._client;
12691269

1270-
let openFileBrowser = (ownerUri: string, expandPath: string, fileFilters: string[], changeFilter: boolean): Thenable<boolean> => {
1271-
let params: types.FileBrowserOpenParams = { ownerUri, expandPath, fileFilters, changeFilter };
1270+
let openFileBrowser = (ownerUri: string, expandPath: string, fileFilters: string[], changeFilter: boolean, showFoldersOnly?: boolean): Thenable<boolean> => {
1271+
let params: types.FileBrowserOpenParams = { ownerUri, expandPath, fileFilters, changeFilter, showFoldersOnly };
12721272
return client.sendRequest(protocol.FileBrowserOpenRequest.type, params).then(
12731273
r => r,
12741274
e => {

src/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,7 @@ export interface FileBrowserOpenParams {
184184
expandPath: string;
185185
fileFilters: string[];
186186
changeFilter: boolean;
187+
showFoldersOnly?: boolean;
187188
}
188189

189190
export interface FileTreeNode {

0 commit comments

Comments
 (0)