Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions docs/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,12 @@ To build Hide from source, follow these steps:
npm install -g typescript-language-server
```

For Java, install the [Eclipse JDT Language Server](https://projects.eclipse.org/projects/eclipse.jdt.ls). Ensure the `jdtls` binary is available on your `PATH`. For example, using Homebrew:

```bash
brew install jdtls
```

For Go, install the `gopls` package:

```bash
Expand Down
2 changes: 1 addition & 1 deletion docs/quickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ print(file)
#129 | )
```

It turns out there was a typo in my patch but Hide noticed it and highlighted the line with the error. Like a normal IDE, Hide runs continuous diagnostics on the code using LSP servers and highlights errors. Currently, Hide provides diagnostics for Python, JavaScript, TypeScript, and Go, and we can add more languages if needed. Let us know in the GitHub Issues if you need support for other languages.
It turns out there was a typo in my patch but Hide noticed it and highlighted the line with the error. Like a normal IDE, Hide runs continuous diagnostics on the code using LSP servers and highlights errors. Currently, Hide provides diagnostics for Python, Java, JavaScript, TypeScript, and Go, and we can add more languages if needed. Let us know in the GitHub Issues if you need support for other languages.

!!! note

Expand Down
2 changes: 1 addition & 1 deletion openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@ components:
type: array
items:
type: string
enum: [Go, JavaScript, Python, TypeScript]
enum: [Go, Java, JavaScript, Python, TypeScript]
devcontainer:
$ref: '#/components/schemas/DevContainerConfig'

Expand Down
1 change: 1 addition & 0 deletions pkg/lsp/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ type (

var LspServerExecutables = map[LanguageId]Command{
Go: NewCommand("gopls", []string{}),
Java: NewCommand("jdtls", []string{}),
Python: NewCommand("pyright-langserver", []string{"--stdio"}),
JavaScript: NewCommand("typescript-language-server", []string{"--stdio"}),
TypeScript: NewCommand("typescript-language-server", []string{"--stdio"}),
Expand Down
1 change: 1 addition & 0 deletions pkg/lsp/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
// For reference see https://github.com/go-enry/go-enry/blob/master/data/languageInfo.go
const (
Go = LanguageId("Go")
Java = LanguageId("Java")
JavaScript = LanguageId("JavaScript")
Python = LanguageId("Python")
TypeScript = LanguageId("TypeScript")
Expand Down
66 changes: 66 additions & 0 deletions pkg/lsp/v2/languages/java_lsp.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
package lang

import (
"context"
"encoding/json"
"fmt"
"os"
"os/exec"
"path/filepath"

protocol "github.com/tliron/glsp/protocol_3_16"
)

var _ Adapter = (*jdtls)(nil)

type jdtls struct{}

type jdtlsVersion struct {
Version string `json:"version"`
}

func (a *jdtls) Name() ServerName {
return "jdtls"
}

func (a *jdtls) FetchLatestServerVersion(ctx context.Context, delegate Delegate) (interface{}, error) {
// jdtls does not expose a simple version endpoint. We rely on the binary
// being present on PATH and treat it as "latest".
return jdtlsVersion{Version: "latest"}, nil
}

func (a *jdtls) FetchServerBinary(ctx context.Context, version interface{}, delegate Delegate) (*Binary, error) {
path, err := exec.LookPath("jdtls")
if err != nil {
return nil, fmt.Errorf("jdtls language server not found in PATH: %w", err)
}

dataDir := filepath.Join(delegate.ProjectRootPath(), ".jdtls")
if err := os.MkdirAll(dataDir, 0o755); err != nil {
return nil, fmt.Errorf("failed to create jdtls data directory: %w", err)
}

return &Binary{
Name: a.Name(),
Path: path,
Arguments: []string{
"-data", dataDir,
},
}, nil
}

func (a *jdtls) InitializationOptions(ctx context.Context, delegate Delegate) json.RawMessage {
return nil
}

func (a *jdtls) WorkspaceConfiguration(ctx context.Context, delegate Delegate) (json.RawMessage, error) {
return nil, nil
}

func (a *jdtls) CodeActions() ([]protocol.CodeActionKind, error) {
return nil, nil
}

func (a *jdtls) Languages() []LanguageID {
return []LanguageID{Java}
}
3 changes: 2 additions & 1 deletion pkg/lsp/v2/languages/languages.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ type LanguageID = string
// For reference see https://github.com/go-enry/go-enry/blob/master/data/languageInfo.go
const (
Go LanguageID = "Go"
Java LanguageID = "Java"
JavaScript LanguageID = "JavaScript"
Python LanguageID = "Python"
TypeScript LanguageID = "TypeScript"
Expand All @@ -15,5 +16,5 @@ const (
)

var Adapters = []Adapter{
new(gopls), new(tsserver),
new(gopls), new(tsserver), new(jdtls),
}
2 changes: 1 addition & 1 deletion pkg/project/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const MaxDiagnosticsDelay = time.Second * 1
type CreateProjectRequest struct {
Repository model.Repository `json:"repository" validate:"required"`
DevContainer *devcontainer.Config `json:"devcontainer,omitempty"`
Languages []lsp.LanguageId `json:"languages,omitempty" validate:"dive,oneof=Go JavaScript Python TypeScript"`
Languages []lsp.LanguageId `json:"languages,omitempty" validate:"dive,oneof=Go Java JavaScript Python TypeScript"`
}

type TaskResult struct {
Expand Down
2 changes: 1 addition & 1 deletion pkg/project/v2/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ type Repository struct {
type CreateProjectRequest struct {
Repository Repository `json:"repository" validate:"required"`
DevContainer *devcontainer.Config `json:"devcontainer,omitempty"`
Languages []lang.LanguageID `json:"languages,omitempty" validate:"dive,oneof=Go JavaScript Python TypeScript"`
Languages []lang.LanguageID `json:"languages,omitempty" validate:"dive,oneof=Go Java JavaScript Python TypeScript"`
}

type Manager interface {
Expand Down