mirror of
https://github.com/Myzel394/config-lsp.git
synced 2025-06-18 23:15:26 +02:00
chore: Use both inclusive ranges for location ranges
This commit is contained in:
parent
82a08d6459
commit
82797de8e5
@ -57,7 +57,7 @@ func (l LocationRange) ToLSPRange() protocol.Range {
|
||||
},
|
||||
End: protocol.Position{
|
||||
Line: l.End.Line,
|
||||
Character: l.End.Character,
|
||||
Character: l.End.Character + 1,
|
||||
},
|
||||
}
|
||||
}
|
||||
@ -115,7 +115,7 @@ func CharacterRangeFromCtx(
|
||||
},
|
||||
End: Location{
|
||||
Line: line,
|
||||
Character: end + 1,
|
||||
Character: end,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
@ -105,11 +105,11 @@ luke: :include:/etc/other_aliases
|
||||
t.Fatalf("Expected path to be '/etc/other_aliases', got %v", includeValue.Path.Path)
|
||||
}
|
||||
|
||||
if !(includeValue.Location.Start.Character == 6 && includeValue.Location.End.Character == 33) {
|
||||
if !(includeValue.Location.Start.Character == 6 && includeValue.Location.End.Character == 32) {
|
||||
t.Fatalf("Expected location to be 6-33, got %v-%v", includeValue.Location.Start.Character, includeValue.Location.End.Character)
|
||||
}
|
||||
|
||||
if !(includeValue.Path.Location.Start.Character == 15 && includeValue.Path.Location.End.Character == 33) {
|
||||
if !(includeValue.Path.Location.Start.Character == 15 && includeValue.Path.Location.End.Character == 32) {
|
||||
t.Fatalf("Expected path location to be 15-33, got %v-%v", includeValue.Path.Location.Start.Character, includeValue.Path.Location.End.Character)
|
||||
}
|
||||
}
|
||||
|
@ -51,7 +51,7 @@ func TestValidSimpleExampleWorks(
|
||||
t.Errorf("Expected start to be 0, but got %v", entry.Location.Start)
|
||||
}
|
||||
|
||||
if !(entry.Location.End.Character == 17) {
|
||||
if !(entry.Location.End.Character == 16) {
|
||||
t.Errorf("Expected end to be 17, but got %v", entry.Location.End.Character)
|
||||
}
|
||||
|
||||
@ -63,7 +63,7 @@ func TestValidSimpleExampleWorks(
|
||||
t.Errorf("Expected IP address start to be 0, but got %v", entry.IPAddress.Location.Start.Character)
|
||||
}
|
||||
|
||||
if !(entry.IPAddress.Location.End.Character == 7) {
|
||||
if !(entry.IPAddress.Location.End.Character == 6) {
|
||||
t.Errorf("Expected IP address end to be 7, but got %v", entry.IPAddress.Location.End.Character)
|
||||
}
|
||||
|
||||
|
@ -49,7 +49,7 @@ func TextDocumentHover(
|
||||
hostname = entry.Hostname
|
||||
case handlers.HoverTargetAlias:
|
||||
for _, alias := range entry.Aliases {
|
||||
if alias.Location.Start.Character <= character && character <= alias.Location.End.Character {
|
||||
if character >= alias.Location.Start.Character && character <= alias.Location.End.Character {
|
||||
hostname = alias
|
||||
break
|
||||
}
|
||||
|
@ -31,13 +31,13 @@ PasswordAuthentication yes
|
||||
firstEntry.LocationRange.Start.Line == 0 &&
|
||||
firstEntry.LocationRange.End.Line == 0 &&
|
||||
firstEntry.LocationRange.Start.Character == 0 &&
|
||||
firstEntry.LocationRange.End.Character == 18 &&
|
||||
firstEntry.LocationRange.End.Character == 17 &&
|
||||
firstEntry.Key.Value == "PermitRootLogin" &&
|
||||
firstEntry.Key.LocationRange.Start.Character == 0 &&
|
||||
firstEntry.Key.LocationRange.End.Character == 15 &&
|
||||
firstEntry.Key.LocationRange.End.Character == 14 &&
|
||||
firstEntry.OptionValue.Value == "no" &&
|
||||
firstEntry.OptionValue.LocationRange.Start.Character == 16 &&
|
||||
firstEntry.OptionValue.LocationRange.End.Character == 18) {
|
||||
firstEntry.OptionValue.LocationRange.End.Character == 17) {
|
||||
t.Errorf("Expected first entry to be PermitRootLogin no, but got: %v", firstEntry)
|
||||
}
|
||||
|
||||
@ -48,13 +48,13 @@ PasswordAuthentication yes
|
||||
secondEntry.LocationRange.Start.Line == 1 &&
|
||||
secondEntry.LocationRange.End.Line == 1 &&
|
||||
secondEntry.LocationRange.Start.Character == 0 &&
|
||||
secondEntry.LocationRange.End.Character == 26 &&
|
||||
secondEntry.LocationRange.End.Character == 25 &&
|
||||
secondEntry.Key.Value == "PasswordAuthentication" &&
|
||||
secondEntry.Key.LocationRange.Start.Character == 0 &&
|
||||
secondEntry.Key.LocationRange.End.Character == 22 &&
|
||||
secondEntry.Key.LocationRange.End.Character == 21 &&
|
||||
secondEntry.OptionValue.Value == "yes" &&
|
||||
secondEntry.OptionValue.LocationRange.Start.Character == 23 &&
|
||||
secondEntry.OptionValue.LocationRange.End.Character == 26) {
|
||||
secondEntry.OptionValue.LocationRange.End.Character == 25) {
|
||||
t.Errorf("Expected second entry to be PasswordAuthentication yes, but got: %v", secondEntry)
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user