Skip to content

Commit

Permalink
lsp: fix file extension checks
Browse files Browse the repository at this point in the history
  • Loading branch information
GraphR00t committed May 16, 2024
1 parent a54d7be commit 9ab0810
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
3 changes: 2 additions & 1 deletion internal/projectserver/completions.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package projectserver
import (
"context"
"io/fs"
"path/filepath"
"strings"

"github.com/inoxlang/inox/internal/afs"
Expand Down Expand Up @@ -30,7 +31,7 @@ func handleCompletion(ctx context.Context, req *defines.CompletionParams) (resul
if err != nil {
return nil, err
}
if fpath != inoxconsts.INOXLANG_FILE_EXTENSION {
if filepath.Ext(string(fpath)) != inoxconsts.INOXLANG_FILE_EXTENSION {
//Not supported yet.
return &[]defines.CompletionItem{}, nil
}
Expand Down
8 changes: 4 additions & 4 deletions internal/projectserver/standard_lsp_methods.go
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ func handleHover(callCtx context.Context, req *defines.HoverParams) (result *def
session.lock.Unlock()
return nil, err
}
if fpath != inoxconsts.INOXLANG_FILE_EXTENSION {
if filepath.Ext(string(fpath)) != inoxconsts.INOXLANG_FILE_EXTENSION {
session.lock.Unlock()
//Not supported yet.
return &defines.Hover{}, nil
Expand Down Expand Up @@ -262,7 +262,7 @@ func handleSignatureHelp(callCtx context.Context, req *defines.SignatureHelpPara
return nil, err
}

if fpath != inoxconsts.INOXLANG_FILE_EXTENSION {
if filepath.Ext(string(fpath)) != inoxconsts.INOXLANG_FILE_EXTENSION {
//Not supported yet.
return &defines.SignatureHelp{}, nil
}
Expand Down Expand Up @@ -348,7 +348,7 @@ func handleDefinition(callCtx context.Context, req *defines.DefinitionParams) (r
if err != nil {
return nil, err
}
if fpath != inoxconsts.INOXLANG_FILE_EXTENSION {
if filepath.Ext(string(fpath)) != inoxconsts.INOXLANG_FILE_EXTENSION {
//Not supported yet.
return &[]defines.LocationLink{}, nil
}
Expand Down Expand Up @@ -495,7 +495,7 @@ func handleFormatDocument(callCtx context.Context, req *defines.DocumentFormatti
if err != nil {
return nil, err
}
if fpath != inoxconsts.INOXLANG_FILE_EXTENSION {
if filepath.Ext(string(fpath)) != inoxconsts.INOXLANG_FILE_EXTENSION {
//Not supported yet.
return &[]defines.TextEdit{}, nil
}
Expand Down

0 comments on commit 9ab0810

Please sign in to comment.