mirror of
https://github.com/Myzel394/config-lsp.git
synced 2025-06-18 23:15:26 +02:00
27 lines
618 B
Go
27 lines
618 B
Go
package common
|
|
|
|
import protocol "github.com/tliron/glsp/protocol_3_16"
|
|
|
|
// LSPCharacterAsCursorPosition:
|
|
// @deprecated
|
|
func CursorToCharacterIndex(cursor uint32) uint32 {
|
|
return max(1, cursor) - 1
|
|
}
|
|
|
|
func DeprecatedImprovedCursorToIndex(
|
|
c CursorPosition,
|
|
line string,
|
|
offset uint32,
|
|
) uint32 {
|
|
if len(line) == 0 {
|
|
return 0
|
|
}
|
|
|
|
return min(uint32(len(line)-1), uint32(c)-offset+1)
|
|
}
|
|
|
|
var SeverityError = protocol.DiagnosticSeverityError
|
|
var SeverityWarning = protocol.DiagnosticSeverityWarning
|
|
var SeverityInformation = protocol.DiagnosticSeverityInformation
|
|
var SeverityHint = protocol.DiagnosticSeverityHint
|