diff --git a/CHANGELOG.adoc b/CHANGELOG.adoc index e180ef710f..a4e6882dae 100644 --- a/CHANGELOG.adoc +++ b/CHANGELOG.adoc @@ -80,6 +80,7 @@ As a result, the following maven modules have been deleted: `sirius-web-sample-a - https://github.com/eclipse-sirius/sirius-web/issues/3869[#3869] [form] Close form-based views when the underlying element no longer exists. - https://github.com/eclipse-sirius/sirius-web/issues/3899[#3899] [diagram] Fix an issue when using alt-tab shortcut and trying to drag a node afterwards - https://github.com/eclipse-sirius/sirius-web/issues/3911[#3911] [diagram] Fix overflow issue with labels, ensuring proper wrapping and ellipsis. +- https://github.com/eclipse-sirius/sirius-web/issues/3933[#3933] [vs-code] Fix explorer in vscode extension === New Features diff --git a/vscode-extension/src/data/ProjectData.ts b/vscode-extension/src/data/ProjectData.ts index 67c4605c98..c038ef4e33 100644 --- a/vscode-extension/src/data/ProjectData.ts +++ b/vscode-extension/src/data/ProjectData.ts @@ -10,16 +10,19 @@ * Contributors: * Obeo - initial API and implementation *******************************************************************************/ - import axios from 'axios'; import { v4 as uuid } from 'uuid'; import { commands, window } from 'vscode'; import { w3cwebsocket as W3CWebSocket } from 'websocket'; import { ModelData } from './ModelData'; -import { GQLGetRepresentationMetadataResponse } from './ProjectData.types'; +import { GQLGetRepresentationMetadataResponse, GQLStyledString } from './ProjectData.types'; import { RepresentationData } from './RepresentationData'; import { getTreeEventSubscription } from './getTreeEventSubscription'; +const getTextFromStyledString = (styledString: GQLStyledString): string => { + return styledString.styledStringFragments.map((fragments) => fragments.text).join(); +}; + export class ProjectData { private modelsData: ModelData[]; private representationsData: RepresentationData[]; @@ -104,9 +107,16 @@ export class ProjectData { private buildModelData(elements: []): ModelData[] { const modelsData: ModelData[] = []; elements.forEach( - (element: { id: string; label: string; kind: string; imageURL: string; hasChildren: boolean; children: [] }) => { + (element: { + id: string; + label: GQLStyledString; + kind: string; + imageURL: string; + hasChildren: boolean; + children: []; + }) => { if (!this.isHandledRepresentation(element)) { - let elementLabel = element.label; + let elementLabel = getTextFromStyledString(element.label); if (elementLabel === undefined || elementLabel.length === 0) { elementLabel = String(element.kind.split('::').pop()); } diff --git a/vscode-extension/src/data/ProjectData.types.ts b/vscode-extension/src/data/ProjectData.types.ts index b7a13a365f..d15ce20311 100644 --- a/vscode-extension/src/data/ProjectData.types.ts +++ b/vscode-extension/src/data/ProjectData.types.ts @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2023 Obeo. + * Copyright (c) 2023, 2024 Obeo. * This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at @@ -40,3 +40,35 @@ export interface GQLGetRepresentationMetadataRepresentationMetadata { label: string; kind: string; } + +export interface GQLStyledString { + styledStringFragments: GQLStyledStringFragment[]; +} +export interface GQLStyledStringFragment { + text: string; + styledStringFragmentStyle: GQLStyledStringFragmentStyle; +} +export interface GQLStyledStringFragmentStyle { + font: string; + backgroundColor: string; + foregroundColor: string; + isStruckOut: boolean; + strikeoutColor: string; + underlineColor: string; + borderColor: string; + borderStyle: GQLBorderStyle; + underlineStyle: GQLUnderLineStyle; +} +export type GQLUnderLineStyle = 'NONE' | 'SOLID' | 'DOUBLE' | 'DOTTED' | 'DASHED' | 'WAVY'; + +export type GQLBorderStyle = + | 'NONE' + | 'HIDDEN' + | 'DOTTED' + | 'DASHED' + | 'SOLID' + | 'DOUBLE' + | 'GROOVE' + | 'RIDGE' + | 'INSET' + | 'OUTSET'; diff --git a/vscode-extension/src/data/getTreeEventSubscription.ts b/vscode-extension/src/data/getTreeEventSubscription.ts index fecb793b56..a9a616158b 100644 --- a/vscode-extension/src/data/getTreeEventSubscription.ts +++ b/vscode-extension/src/data/getTreeEventSubscription.ts @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2022, 2023 Obeo. + * Copyright (c) 2022, 2024 Obeo. * This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at @@ -37,9 +37,25 @@ fragment treeItemFields on TreeItem { id hasChildren expanded - label + label { + styledStringFragments { + text + styledStringFragmentStyle { + isStruckOut + underlineStyle + borderStyle + font + backgroundColor + foregroundColor + strikeoutColor + underlineColor + borderColor + } + } + } editable deletable + selectable kind iconURL }