Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Unexpected coloring of the token in the editor

Open
#1,003 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
typescript
Domain
tooling

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.

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).

Screenshot 2023-08-25 at 14 22 40

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;
}

Dominant language
TypeScript
Stars
471
Forks
149
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from microsoft/TypeScript-TmLanguage

All issues in microsoft/TypeScript-TmLanguage

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.