-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
1,048 additions
and
1,031 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,14 @@ | ||
.idea/ | ||
dist/ | ||
/test/ | ||
.gopad/ | ||
|
||
/dist/ | ||
/test/ | ||
/config/grammars/ | ||
|
||
go.work | ||
go.work.sum | ||
/debug.log | ||
/lsp.log | ||
/config/grammars/ | ||
|
||
debug.log | ||
lsp.log | ||
trace.log | ||
panic.log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package buffer | ||
|
||
import ( | ||
"github.com/tree-sitter/go-tree-sitter" | ||
) | ||
|
||
func NewByteRange(startByte uint, endByte uint) ByteRange { | ||
return ByteRange{ | ||
StartByte: startByte, | ||
EndByte: endByte, | ||
} | ||
} | ||
|
||
func ParseByteRange(r tree_sitter.Range) ByteRange { | ||
return ByteRange{ | ||
StartByte: r.StartByte, | ||
EndByte: r.EndByte, | ||
} | ||
} | ||
|
||
type ByteRange struct { | ||
StartByte uint | ||
EndByte uint | ||
} | ||
|
||
func (r ByteRange) Contains(i uint) bool { | ||
return i >= r.StartByte && i <= r.EndByte | ||
} | ||
|
||
func (r ByteRange) ContainsRange(other ByteRange) bool { | ||
return r.StartByte <= other.StartByte && r.EndByte >= other.EndByte | ||
} | ||
|
||
func (r ByteRange) IsEmpty() bool { | ||
return r.StartByte == r.EndByte | ||
} | ||
|
||
func (r ByteRange) Bytes() uint { | ||
return r.EndByte - r.StartByte | ||
} | ||
|
||
func (r ByteRange) ToTreeSitter() tree_sitter.Range { | ||
return tree_sitter.Range{ | ||
StartByte: r.StartByte, | ||
EndByte: r.EndByte, | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.