menu
announcement

Spectrum is now read-only. Learn more about the decision in our official announcement.

Theia

Eclipse Theia - Cloud & Desktop IDE

Channels
Team

Base of position index in main/ext interface

January 28, 2019 at 12:52pm

Base of position index in main/ext interface

January 28, 2019 at 12:52pm
Hi folks,
I've noticed that we use line/character indices based on 1 for ranges and positions in packages/plugin-ext/src/api/model.ts. and .../plugin-api.ts.
This seems confusing to me. In the plugin API (both vscode and theia), in LSP and even in some of the theia internal classes (ProblemManager, for example); we use 0-based positions and ranges.
I feel it would be very helpful if we had a clear policy on this and would use the same base everywhere. I think it comes down to if theia is based on LSP (and related technologies) with Monaco as an implementation detail or if Monaco is our base and LSP, etc. are connectors to the outside world.
thoughts?

January 28, 2019 at 12:58pm
I understand that those are different. However, which should be the primary representation in Theia? Should we do 0-based and convert when we move the data into Monaco? Or should we keep 1-based positions everywhere and therefore convert positions as soon as we get them from LSP or a vscode plugin?

January 29, 2019 at 7:21am
In Theia we use LSP types as API, so 0-based
i think it is the case already
only when we work with Monaco positions are converted to 1-based