Skip to content

Commit

Permalink
switch case
Browse files Browse the repository at this point in the history
  • Loading branch information
julienduchesne committed Aug 7, 2024
1 parent d09c7f3 commit 128c21d
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions pkg/server/cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,12 @@ func (c *cache) getContents(uri protocol.DocumentURI, position protocol.Range) (

contentBuilder := strings.Builder{}
for i := position.Start.Line; i <= position.End.Line; i++ {
if i == position.Start.Line {
switch i {
case position.Start.Line:
contentBuilder.WriteString(lines[i][position.Start.Character:])
} else if i == position.End.Line {
case position.End.Line:
contentBuilder.WriteString(lines[i][:position.End.Character])
} else {
default:
contentBuilder.WriteString(lines[i])
}
if i != position.End.Line {
Expand Down

0 comments on commit 128c21d

Please sign in to comment.