Skip to content

Make PositionEncodingKind a type - #1442

Merged
Dirk Bäumer (dbaeumer) merged 2 commits into
microsoft:gh-pagesfrom
michaelpj:mpj/position-encoding-kinds
Apr 13, 2022
Merged

Dirk Bäumer (dbaeumer) merged 2 commits into
microsoft:gh-pagesfrom
michaelpj:mpj/position-encoding-kinds

Conversation

@michaelpj

Copy link
Copy Markdown
Contributor

As discussed here:
f9c85d5#r70968669

I made a change that reflected the existing state, but looking at it, it still reads somewhat ambiguously to me.
We are talking about an overall "position encoding", but in fact it only has quite a specific meaning: what is counted by character offsets.

If we were open to a slightly bigger change, we could consider something like:

// with a proper type obviously
type CharacterOffsetUnit = 'utf-8-codeunits'|'utf-16-codeunits'|'unicode-codepoints';
interface PositionCapabilities {
  characterOffsetUnits: CharacterOffsetUnit;
}

@ghost

Deleted user (ghost) commented Apr 11, 2022 •

Copy link
Copy Markdown

CLA assistant check
All CLA requirements met.

@nemethf

Copy link
Copy Markdown

Maybe I'm overthinking this, but explaining the original a𐐀b example of the current specification for each encoding would make this even clearer. Or not. Thank you.

Comment thread _specifications/lsp/3.17/types/position.md Outdated
@michaelpj

Copy link
Copy Markdown
Contributor Author

Maybe I'm overthinking this, but explaining the original a𐐀b example of the current specification for each encoding would make this even clearer. Or not. Thank you.

I think so long as we're referring to clearly understood ways of dealing with text, we can assume that programmers will go elsewhere to understand what e.g. "indexing in UTF-8 code units" means.

@dbaeumer
Dirk Bäumer (dbaeumer) merged commit e821641 into microsoft:gh-pages Apr 13, 2022
@dbaeumer Dirk Bäumer (dbaeumer) added this to the 3.17 milestone Apr 13, 2022
@dbaeumer

Copy link
Copy Markdown
Member

I think so long as we're referring to clearly understood ways of dealing with text, we can assume that programmers will go elsewhere to understand what e.g. "indexing in UTF-8 code units" means.

Michael Peyton Jones (@michaelpj) are you willing to provide this as a PR as well?

@michaelpj

Copy link
Copy Markdown
Contributor Author

I meant that I think the current text is clear enough, since it uses standard terminology. Perhaps Felicián Németh (@nemethf) disagrees?

@dbaeumer

Copy link
Copy Markdown
Member

Michael Peyton Jones (@michaelpj) sorry misunderstood.

@nemethf

Copy link
Copy Markdown

Perhaps Felicián Németh (@nemethf) disagrees?

I don't.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants