Skip to content

Commit

Permalink
fix: Fix adding forms file as local resource root
Browse files Browse the repository at this point in the history
  • Loading branch information
travisstebbins committed Feb 5, 2025
1 parent 8f3bcd5 commit 046a95a
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
16 changes: 10 additions & 6 deletions packages/extension/src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -298,9 +298,11 @@ const showDiagramWebView = async (
)
? [
Uri.file(
workspace
.getConfiguration('legend')
.get('studio.forms.file', ''),
path.dirname(
workspace
.getConfiguration('legend')
.get('studio.forms.file', ''),
),
),
]
: []),
Expand Down Expand Up @@ -382,9 +384,11 @@ const showQueryBuilderWebView = async (
)
? [
Uri.file(
workspace
.getConfiguration('legend')
.get('studio.forms.file', ''),
path.dirname(
workspace
.getConfiguration('legend')
.get('studio.forms.file', ''),
),
),
]
: []),
Expand Down
2 changes: 2 additions & 0 deletions packages/extension/src/webviews/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import {
type TextLocation,
GET_PROJECT_ENTITIES,
GET_PROJECT_ENTITIES_RESPONSE,
isEmpty,
QUERY_BUILDER_CONFIG_ERROR,
WRITE_ENTITY,
} from '@finos/legend-engine-ide-client-vscode-shared';
Expand All @@ -38,6 +39,7 @@ import { type LegendConceptTreeProvider } from '../conceptTree';
import { TextDocumentIdentifier } from 'vscode-languageclient';

export const isLocalFilePath = (filePath: string): boolean =>
!isEmpty(filePath) &&
new URL(filePath, workspace.workspaceFolders?.[0]?.uri.toString())
.protocol === 'file:';

Expand Down
3 changes: 3 additions & 0 deletions packages/shared/src/utils/AssertionUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,3 +69,6 @@ export const isObject = (val: unknown): val is object =>

export const isPlainObject = (val: unknown): val is PlainObject =>
isObject(val) && val.constructor.name === 'Object';

export const isEmpty = (val: string): boolean =>
val === undefined || val === null || val.trim() === '';

0 comments on commit 046a95a

Please sign in to comment.