Open aiday-mar opened 1 year ago
Hey @hediet, not sure if I should assign this to you? Feel free to change assignment.
When I add a whitespace after ?
it works:
globalThis.x = (
globalThis ?
1 : foobar
);
I see, the color schema is correct now too in the editor. I suppose that it had something to do with saving the document or formatting the document for the token colors to be rendered appropriately. I'll close the issue.
I think this is indeed a bug of the typescript grammar!
While examining code in the diff editor, I noticed that the color schema appears to be off. Notice how in the following image, the
this
token on line 322 is colored green while it should actually be a dark blue (like the other this tokens).I was using the following code:
Code
``` private _renderFoldingIconForLine(container: HTMLSpanElement, foldingModel: FoldingModel | null | undefined, index: number, line: number): FoldingIcon | undefined { const showFoldingControls: 'mouseover' | 'always' | 'never' = this._editor.getOption(EditorOption.showFoldingControls); if (!foldingModel || showFoldingControls === 'never') { return; } const foldingRegions = foldingModel.regions; const indexOfFoldingRegion = foldingRegions.findRange(line); const startLineNumber = foldingRegions.getStartLineNumber(indexOfFoldingRegion); const isFoldingScope = line === startLineNumber; if (!isFoldingScope) { return; } const foldingIconNode = container.appendChild(document.createElement('div')); const isCollapsed = foldingRegions.isCollapsed(indexOfFoldingRegion); foldingIconNode.className = ThemeIcon.asClassName(isCollapsed ? foldingCollapsedIcon : foldingExpandedIcon); const foldingIcon = new FoldingIcon(foldingIconNode, isCollapsed); foldingIcon.setVisible(isCollapsed || showFoldingControls === 'always'); foldingIcon.setTransitionRequired(true); this._foldingIconStore.add(dom.addDisposableListener(foldingIconNode, dom.EventType.CLICK, () => { toggleCollapseState(foldingModel, Number.MAX_VALUE, [line]); foldingIcon.isCollapsed = !isCollapsed; const scrollTop = ( isCollapsed ? this._editor.getTopForLineNumber(startLineNumber) : this._editor.getTopForLineNumber(foldingRegions.getEndLineNumber(indexOfFoldingRegion))) - this._lineHeight * index + 1; this._editor.setScrollTop(scrollTop); })); return foldingIcon; } ```