Skip to content

Commit

Permalink
Merge branch 'main' into mnv-creds-services-in-line
Browse files Browse the repository at this point in the history
  • Loading branch information
marcosnav committed Sep 26, 2024
2 parents c6156cd + b77d14d commit 6ed6c53
Show file tree
Hide file tree
Showing 18 changed files with 1,092 additions and 893 deletions.
14 changes: 12 additions & 2 deletions extensions/vscode/src/types/messages/hostToWebviewMessages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export enum HostToWebviewMessageType {
UPDATE_R_PACKAGES = "updateRPackages",
SHOW_DISABLE_OVERLAY = "showDisableOverlay",
HIDE_DISABLE_OVERLAY = "hideDisableOverlay",
SET_PATH_SEPARATOR = "setPathSeparator",
}

export type AnyHostToWebviewMessage<
Expand All @@ -53,7 +54,8 @@ export type HostToWebviewMessage =
| UpdatePythonPackages
| UpdateRPackages
| ShowDisableOverlayMsg
| HideDisableOverlayMsg;
| HideDisableOverlayMsg
| SetPathSeparatorMsg;

export function isHostToWebviewMessage(msg: any): msg is HostToWebviewMessage {
return (
Expand All @@ -70,7 +72,8 @@ export function isHostToWebviewMessage(msg: any): msg is HostToWebviewMessage {
msg.kind === HostToWebviewMessageType.UPDATE_PYTHON_PACKAGES ||
msg.kind === HostToWebviewMessageType.UPDATE_R_PACKAGES ||
msg.kind === HostToWebviewMessageType.SHOW_DISABLE_OVERLAY ||
msg.kind === HostToWebviewMessageType.HIDE_DISABLE_OVERLAY
msg.kind === HostToWebviewMessageType.HIDE_DISABLE_OVERLAY ||
msg.kind === HostToWebviewMessageType.SET_PATH_SEPARATOR
);
}

Expand Down Expand Up @@ -152,3 +155,10 @@ export type ShowDisableOverlayMsg =

export type HideDisableOverlayMsg =
AnyHostToWebviewMessage<HostToWebviewMessageType.HIDE_DISABLE_OVERLAY>;

export type SetPathSeparatorMsg = AnyHostToWebviewMessage<
HostToWebviewMessageType.SET_PATH_SEPARATOR,
{
separator: string;
}
>;
26 changes: 23 additions & 3 deletions extensions/vscode/src/views/homeView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,15 @@ export class HomeViewProvider implements WebviewViewProvider, Disposable {
}

private async onInitializingMsg() {
// inform webview of the platform specific path separator
// (path package is a node library, wrapper for browser doesn't seem to work in webview correctly)
this.webviewConduit.sendMsg({
kind: HostToWebviewMessageType.SET_PATH_SEPARATOR,
content: {
separator: path.sep,
},
});

// send back the data needed. Optimize request for initialization...
await this.refreshAll(false, true);
this.setInitializationContext(HomeViewInitialized.initialized);
Expand Down Expand Up @@ -1076,15 +1085,26 @@ export class HomeViewProvider implements WebviewViewProvider, Disposable {
}

let details = [];
if (!isRelativePathRoot(contentRecord.projectDir)) {
details.push(`${contentRecord.projectDir}${path.sep}`);
}
if (credential?.name) {
details.push(credential.name);
} else {
details.push(`Missing Credential for ${contentRecord.serverUrl}`);
problem = true;
}

if (isRelativePathRoot(contentRecord.projectDir)) {
if (config && !isConfigurationError(config)) {
details.push(config.configuration.entrypoint);
}
} else {
if (config && !isConfigurationError(config)) {
details.push(
`${contentRecord.projectDir}${path.sep}${config.configuration.entrypoint}`,
);
} else {
details.push(`${contentRecord.projectDir}${path.sep}`);
}
}
const detail = details.join(" • ");

let lastMatch =
Expand Down
Loading

0 comments on commit 6ed6c53

Please sign in to comment.