microsoft / microsoft/TypeScript-TmLanguage

Unexpected coloring of the token in the editor

Offen
#1,003 4 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Vorherrschende Sprache
TypeScript
Sterne
471
Forks
149
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

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

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Reproduziere die Farbgebung im VS Code-Diff-Editor mithilfe des bereitgestellten TypeScript-Snippets und Screenshots und untersuche anschließend die TypeScript-TextMate-Grammatik und Token-Scopes für das betroffene this-Token. Das Issue ist abgeschlossen, wenn dieses Token dieselbe dunkelblaue Farbgebung wie die anderen this-Tokens erhält.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
typescript
Bereich
tooling
Issue-Typ
Bug
Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
35/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.