icerpc/slicec

Migrate to 0-indexed spans

Opened this issue · 2 comments

Currently, our spans are 1-indexed to be more in line with how files are represented in editors. However, this has proven to be painful when implementing things like a language server, as the LSP protocol assumes 0-based positions. It would be nice to switch to using 0-based indexing for better compatibility with other tools.

pepone commented

If we change this we will have to fix the MSBuild task https://github.com/icerpc/icerpc-csharp/blob/0b36976cc3acb632e21c85f2982153cc0872f1ef/tools/IceRpc.Slice.Tools/SliceCCSharpTask.cs#L134-L142

So far there would be always tools that are 1-based or 0-based, we should pick one and stick with it.

If we change this we will have to fix the MSBuild task https://github.com/icerpc/icerpc-csharp/blob/0b36976cc3acb632e21c85f2982153cc0872f1ef/tools/IceRpc.Slice.Tools/SliceCCSharpTask.cs#L134-L142

So far there would be always tools that are 1-based or 0-based, we should pick one and stick with it.

Yes, I just think 0 based is more natural - we should do a survey of common tools and see if more are 0 based or 1 based. Generally for programming im inclined to assume things are 0 based.