summaryrefslogtreecommitdiffhomepage
path: root/internal/lsp/protocol/pattern_interfaces.go
diff options
context:
space:
mode:
authoradamdottv <[email protected]>2025-05-29 15:10:44 -0500
committeradamdottv <[email protected]>2025-05-29 15:10:44 -0500
commit37c0c1f358cadbc918319500cd2b1b3fcbe41a9e (patch)
treef012aad2481ea47b062c630420ecc008287a65dc /internal/lsp/protocol/pattern_interfaces.go
parent2a132f86d687be767df4a7657e9c4441b8a4058d (diff)
downloadopencode-37c0c1f358cadbc918319500cd2b1b3fcbe41a9e.tar.gz
opencode-37c0c1f358cadbc918319500cd2b1b3fcbe41a9e.zip
wip: refactoring tui
Diffstat (limited to 'internal/lsp/protocol/pattern_interfaces.go')
-rw-r--r--internal/lsp/protocol/pattern_interfaces.go58
1 files changed, 0 insertions, 58 deletions
diff --git a/internal/lsp/protocol/pattern_interfaces.go b/internal/lsp/protocol/pattern_interfaces.go
deleted file mode 100644
index ebc7053dc..000000000
--- a/internal/lsp/protocol/pattern_interfaces.go
+++ /dev/null
@@ -1,58 +0,0 @@
-package protocol
-
-import (
- "fmt"
- "strings"
-)
-
-// PatternInfo is an interface for types that represent glob patterns
-type PatternInfo interface {
- GetPattern() string
- GetBasePath() string
- isPattern() // marker method
-}
-
-// StringPattern implements PatternInfo for string patterns
-type StringPattern struct {
- Pattern string
-}
-
-func (p StringPattern) GetPattern() string { return p.Pattern }
-func (p StringPattern) GetBasePath() string { return "" }
-func (p StringPattern) isPattern() {}
-
-// RelativePatternInfo implements PatternInfo for RelativePattern
-type RelativePatternInfo struct {
- RP RelativePattern
- BasePath string
-}
-
-func (p RelativePatternInfo) GetPattern() string { return string(p.RP.Pattern) }
-func (p RelativePatternInfo) GetBasePath() string { return p.BasePath }
-func (p RelativePatternInfo) isPattern() {}
-
-// AsPattern converts GlobPattern to a PatternInfo object
-func (g *GlobPattern) AsPattern() (PatternInfo, error) {
- if g.Value == nil {
- return nil, fmt.Errorf("nil pattern")
- }
-
- switch v := g.Value.(type) {
- case string:
- return StringPattern{Pattern: v}, nil
- case RelativePattern:
- // Handle BaseURI which could be string or DocumentUri
- basePath := ""
- switch baseURI := v.BaseURI.Value.(type) {
- case string:
- basePath = strings.TrimPrefix(baseURI, "file://")
- case DocumentUri:
- basePath = strings.TrimPrefix(string(baseURI), "file://")
- default:
- return nil, fmt.Errorf("unknown BaseURI type: %T", v.BaseURI.Value)
- }
- return RelativePatternInfo{RP: v, BasePath: basePath}, nil
- default:
- return nil, fmt.Errorf("unknown pattern type: %T", g.Value)
- }
-}