microsoft / microsoft/TypeScript-TmLanguage
Unexpected coloring of the token in the editor
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 471
- Forks
- 149
- PR merge metrics
- No merged PRs in 30d
Description
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;
}
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the coloring in the VS Code diff editor using the supplied TypeScript snippet and screenshot, then inspect the TypeScript TextMate grammar and token scopes for the affected this token. The issue is done when that token receives the same dark-blue coloring as the other this tokens.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100