Skip to content
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

fix descriptions missing in tree of plugin #10253

Merged
merged 1 commit into from
Oct 28, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
- renamed `handleDefault` to `handleElectronDefault`
- renamed `createContextMenu` to `createElectronContextMenu`
- renamed `createMenuBar` to `createElectronMenuBar`
- [plugin-ext] removed unnecessary function `getCaption` [#10253](https://github.com/eclipse-theia/theia/pull/10253)
- [core] moved `DEFAULT_WINDOW_HASH` to `common/window.ts` [#10291](https://github.com/eclipse-theia/theia/pull/10291)
- [core] moved `NewWindowOptions` to `common/window.ts` [#10291](https://github.com/eclipse-theia/theia/pull/10291)

Expand Down
38 changes: 3 additions & 35 deletions packages/plugin-ext/src/main/browser/view/tree-view-widget.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -319,43 +319,11 @@ export class TreeViewWidget extends TreeViewWelcomeWidget {
} else if (!highlight) {
children.push(caption);
}
return React.createElement('div', attrs, ...children);
}

protected getCaption(node: TreeNode): React.ReactNode {
RomanNikitenko marked this conversation as resolved.
Show resolved Hide resolved
const nodes: React.ReactNode[] = [];

const name = this.toNodeName(node) || '';
const description = this.toNodeDescription(node);

let work = name;

const regex = /\[([^\[]+)\]\(([^\)]+)\)/g;
const matchResult = work.match(regex);

if (matchResult) {
matchResult.forEach((match, index) => {
nodes.push(<span key={`m${index}`}>{work.substring(0, work.indexOf(match))}</span>);

const execResult = regex.exec(name);
nodes.push(<a key={`l${index}`}
href={execResult![2]}
target='_blank'
className={TREE_NODE_HYPERLINK}
onClick={e => e.stopPropagation()}>{execResult![1]}</a>
);

work = work.substring(work.indexOf(match) + match.length);
});
if (description) {
children.push(<span className='theia-tree-view-description'>{description}</span>);
}

return <div className='noWrapInfoTree'>
{...nodes}
{work && <span>{work}</span>}
{description && <span className='theia-tree-view-description'>
{description}
</span>}
</div>;
return React.createElement('div', attrs, ...children);
}

protected renderTailDecorations(node: TreeViewNode, props: NodeProps): React.ReactNode {
Expand Down