microsoft / microsoft/TypeScript

Content mapper duplicated inlay hints

Offen
#64,050 2 Kommentare 0 Reaktionen 1 zugewiesene Person Auf GitHub ansehen

@andrewbranch arbeitet bereits daran.

Seit 27.8.2026.

Needs Investigation
Vorherrschende Sprache
Go
Sterne
111k
Forks
14.3k
Ø Merge
2 T. 4 Std.
Gemergte PRs (30 T.)
132

Beschreibung

### 🔎 Search Terms

inlay hints
content-mapper

### 🕗 Version & Regression Information

I was unable to test this on prior versions because this is newly added

### ⏯ Playground Link

_No response_

### 💻 Code

### 🙁 Actual behavior

When a content mapper splits a statement into multiple spans, the inlay hints result is duplicated. In the inlay hints request, the request range is mapped into multiple ranges and calculated separately. Because the statement is in multiple spans, the hint for that statement is returned multiple times.

Four slash test failed case:
```go
package fourslash_test

import (
"testing"

"github.com/microsoft/TypeScript/tsc/internal/ls/lsutil"
"github.com/microsoft/TypeScript/tsc/internal/testutil"
"github.com/microsoft/TypeScript/tsc/internal/testutil/contentmappertest"
)

func TestContentMapperInlayHints(t *testing.T) {
t.Parallel()
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
f, done := newContentMapperFourslash(t, `// @Filename: /app.lisp
(+ 1 2 "oops")

// @Filename: /main.ts
declare function add(a: number, b: number, c: string): number;
`, contentmappertest.LispMapper, ".lisp")
defer done()

f.GoToFile(t, "/app.lisp")
f.VerifyBaselineInlayHints(t, nil /*span*/, &lsutil.UserPreferences{InlayHints: lsutil.InlayHintsPreferences{IncludeInlayParameterNameHints: lsutil.IncludeInlayParameterNameHintsAll}})
}
```

### 🙂 Expected behavior

Probably need to deduplicate when multiple spans map to the inlay hint request range.

### Additional information about the issue

_No response_

Beitragsleitfaden

Beitragsleitfaden öffnen

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.

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

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