Skip to content

Commit

Permalink
fix detection of single file during initialization (#172)
Browse files Browse the repository at this point in the history
  • Loading branch information
radeksimko authored Jun 19, 2020
1 parent e5227ca commit ae57dbd
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions langserver/handlers/initialize.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,13 @@ func (lh *logHandler) Initialize(ctx context.Context, params lsp.InitializeParam
}

fh := ilsp.FileHandlerFromDirURI(params.RootURI)
if !fh.Valid() {
return serverCaps, fmt.Errorf("URI %q is not valid", params.RootURI)
}

if !fh.IsDir() {
if fh.URI() == "" || !fh.IsDir() {
return serverCaps, fmt.Errorf("Editing a single file is not yet supported." +
" Please open a directory.")
}
if !fh.Valid() {
return serverCaps, fmt.Errorf("URI %q is not valid", params.RootURI)
}

err := lsctx.SetClientCapabilities(ctx, &params.Capabilities)
if err != nil {
Expand Down

0 comments on commit ae57dbd

Please sign in to comment.