basarat / basarat/typescript-book

Language service: meaning of encoding in classifiers

Open
#35 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
21.6k
Forks
2.6k
PR merge metrics
No merged PRs in 30d

Description

The following code : https://github.com/Microsoft/TypeScript/blob/12c6a7400dffc10c41f9245da64fbd5beeceb3dc/src/services/services.ts#L7843-L7847

``` ts
if (length > 0) {
result.spans.push(start);
result.spans.push(length);
result.spans.push(classification);
}
```

I also found the comment `// Encoded as triples of [start, length, ClassificationType].` in the source. It was completely unobvious till I reviewed the code and can break on API consumers if new things are needed. Would be better if it was moved into `{start,length,classification}` datastructure, but I guess they did it for performance reasons :rose:

Contributor guide

Open the contributing guide

Research direction

Start by reading the linked range in src/services/services.ts and the nearby comment describing triples of [start, length, ClassificationType]. Determine whether this repository should explain the classifier encoding or whether the concern belongs upstream; done requires an agreed scope and a clear documentation change.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
documentation
Issue type
Documentation
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.