Skip to content

Commit 457ce3f

Browse files
committed
Fixes microsoft#95936: Improve width sizing for tokens inspector widget
1 parent b05d8f3 commit 457ce3f

2 files changed

Lines changed: 4 additions & 1 deletion

File tree

src/vs/workbench/contrib/codeEditor/browser/inspectEditorTokens/inspectEditorTokens.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
.tiw-metadata-value {
3333
font-family: var(--monaco-monospace-font);
3434
text-align: right;
35+
word-break: break-word;
3536
}
3637
.tiw-metadata-key {
3738
vertical-align: top;

src/vs/workbench/contrib/codeEditor/browser/inspectEditorTokens/inspectEditorTokens.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,7 @@ class InspectEditorTokensWidget extends Disposable implements IContentWidget {
251251
}
252252
let text = this._compute(grammar, semanticTokens, position);
253253
this._domNode.innerHTML = text;
254+
this._domNode.style.maxWidth = `${Math.max(this._editor.getLayoutInfo().width * 0.66, 500)}px`;
254255
this._editor.layoutContentWidget(this);
255256
}, (err) => {
256257
this._notificationService.warn(err);
@@ -552,7 +553,8 @@ class InspectEditorTokensWidget extends Disposable implements IContentWidget {
552553
theme.resolveScopes(definition, scopesDefinition);
553554
const matchingRule = scopesDefinition[property];
554555
if (matchingRule && scopesDefinition.scope) {
555-
return `${escape(scopesDefinition.scope.join(' '))}<br><code class="tiw-theme-selector">${matchingRule.scope}\n${JSON.stringify(matchingRule.settings, null, '\t')}</code>`;
556+
const strScopes = Array.isArray(matchingRule.scope) ? matchingRule.scope.join(', ') : String(matchingRule.scope);
557+
return `${escape(scopesDefinition.scope.join(' '))}<br><code class="tiw-theme-selector">${strScopes}\n${JSON.stringify(matchingRule.settings, null, '\t')}</code>`;
556558
}
557559
return '';
558560
} else if (TokenStylingRule.is(definition)) {

0 commit comments

Comments
 (0)