Skip to content

Commit

Permalink
up
Browse files Browse the repository at this point in the history
  • Loading branch information
zhihaopan committed Jul 5, 2024
1 parent a0de1e5 commit 10ce9d5
Show file tree
Hide file tree
Showing 27 changed files with 57 additions and 56 deletions.
2 changes: 1 addition & 1 deletion .gitconfig
Original file line number Diff line number Diff line change
@@ -1 +1 @@
./pls
./protobuf-language-server
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
.idea
.DS_Strore
pls
protobuf-language-server
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

# pls
# protobuf-language-server

A language server implementation for Google Protocol Buffers

Expand All @@ -8,7 +8,7 @@ A language server implementation for Google Protocol Buffers
Build binary

```sh
go build -o pls .
go install github.com/lasorda/protobuf-language-server@master
```

Add it to your PATH
Expand All @@ -20,7 +20,7 @@ Using [coc.nvim](https://github.com/neoclide/coc.nvim), add it to `:CocConfig`
```json
"languageserver": {
"proto" :{
"command": "pls",
"command": "protobuf-language-server",
"filetypes": ["proto", "cpp"]
}
}
Expand All @@ -33,9 +33,9 @@ Using [lsp-config.nvim](https://github.com/neovim/nvim-lspconfig)
local configs = require('lspconfig.configs')
local util = require('lspconfig.util')

configs.pls = {
configs.protobuf-language-server = {
default_config = {
cmd = { 'path/to/pls' },
cmd = { 'path/to/protobuf-language-server' },
filetypes = { 'proto', 'cpp' },
root_fir = util.root_pattern('.git'),
single_file_support = true,
Expand All @@ -45,7 +45,7 @@ configs.pls = {

-- then we can continue as we do with official servers
local lspconfig = require('lspconfig')
lspconfig.pls.setup {}
lspconfig.protobuf-language-server.setup {}
```

if you use vscode, see [vscode-extension/README.md](./vscode-extension/README.md)
Expand Down
5 changes: 3 additions & 2 deletions components/completion.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@ package components

import (
"context"
"pls/proto/view"
"strings"
"time"

"pls/go-lsp/lsp/defines"
"github.com/lasorda/protobuf-language-server/proto/view"

"github.com/lasorda/protobuf-language-server/go-lsp/lsp/defines"
)

var (
Expand Down
6 changes: 3 additions & 3 deletions components/document_symbol.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ package components

import (
"context"
"pls/proto/view"
"github.com/lasorda/protobuf-language-server/proto/view"

"pls/go-lsp/logs"
"pls/go-lsp/lsp/defines"
"github.com/lasorda/protobuf-language-server/go-lsp/logs"
"github.com/lasorda/protobuf-language-server/go-lsp/lsp/defines"
)

func ProvideDocumentSymbol(ctx context.Context, req *defines.DocumentSymbolParams) (result *[]defines.DocumentSymbol, err error) {
Expand Down
4 changes: 2 additions & 2 deletions components/format.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import (
"math"
"os/exec"
"path/filepath"
"pls/proto/view"
"github.com/lasorda/protobuf-language-server/proto/view"

"pls/go-lsp/lsp/defines"
"github.com/lasorda/protobuf-language-server/go-lsp/lsp/defines"
)

func Format(ctx context.Context, req *defines.DocumentFormattingParams) (result *[]defines.TextEdit, err error) {
Expand Down
6 changes: 3 additions & 3 deletions components/hover.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ package components
import (
"bytes"
"context"
"pls/proto/parser"
"pls/proto/view"
"github.com/lasorda/protobuf-language-server/proto/parser"
"github.com/lasorda/protobuf-language-server/proto/view"
"strings"
"text/template"

"pls/go-lsp/lsp/defines"
"github.com/lasorda/protobuf-language-server/go-lsp/lsp/defines"
"github.com/emicklei/proto"
)

Expand Down
8 changes: 4 additions & 4 deletions components/jump_definition.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ import (
"context"
"errors"
"fmt"
"pls/proto/parser"
"pls/proto/view"
"github.com/lasorda/protobuf-language-server/proto/parser"
"github.com/lasorda/protobuf-language-server/proto/view"
"regexp"
"strings"

"pls/go-lsp/logs"
"pls/go-lsp/lsp/defines"
"github.com/lasorda/protobuf-language-server/go-lsp/logs"
"github.com/lasorda/protobuf-language-server/go-lsp/lsp/defines"
)

type SymbolDefinition struct {
Expand Down
Binary file modified go-lsp/example/example
Binary file not shown.
6 changes: 3 additions & 3 deletions go-lsp/example/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ import (
"os"
"strings"

"pls/go-lsp/logs"
"pls/go-lsp/lsp"
"pls/go-lsp/lsp/defines"
"github.com/lasorda/protobuf-language-server/go-lsp/logs"
"github.com/lasorda/protobuf-language-server/go-lsp/lsp"
"github.com/lasorda/protobuf-language-server/go-lsp/lsp/defines"
)

func strPtr(str string) *string {
Expand Down
2 changes: 1 addition & 1 deletion go-lsp/jsonrpc/session.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"strings"
"sync"

"pls/go-lsp/logs"
"github.com/lasorda/protobuf-language-server/go-lsp/logs"
jsoniter "github.com/json-iterator/go"
)

Expand Down
2 changes: 1 addition & 1 deletion go-lsp/lsp/builtin.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package lsp
import (
"context"

"pls/go-lsp/lsp/defines"
"github.com/lasorda/protobuf-language-server/go-lsp/lsp/defines"
)

func (m *Methods) builtinInitialize(ctx context.Context, req *defines.InitializeParams) (defines.InitializeResult, error) {
Expand Down
4 changes: 2 additions & 2 deletions go-lsp/lsp/methods.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ package lsp
// "context"
// "fmt"
//
// "pls/go-lsp/jsonrpc"
// "pls/go-lsp/lsp/defines"
// "github.com/lasorda/protobuf-language-server/go-lsp/jsonrpc"
// "github.com/lasorda/protobuf-language-server/go-lsp/lsp/defines"
//)
//
//type Methods struct {
Expand Down
2 changes: 1 addition & 1 deletion go-lsp/lsp/methods.temp.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package lsp

import "pls/go-lsp/lsp/defines"
import "github.com/lasorda/protobuf-language-server/go-lsp/lsp/defines"

type method struct {
Name string
Expand Down
4 changes: 2 additions & 2 deletions go-lsp/lsp/methods_gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ package lsp
import (
"context"

"pls/go-lsp/jsonrpc"
"pls/go-lsp/lsp/defines"
"github.com/lasorda/protobuf-language-server/go-lsp/jsonrpc"
"github.com/lasorda/protobuf-language-server/go-lsp/lsp/defines"
)

type Methods struct {
Expand Down
2 changes: 1 addition & 1 deletion go-lsp/lsp/methods_gen_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"strings"
"testing"

"pls/go-lsp/lsp/defines"
"github.com/lasorda/protobuf-language-server/go-lsp/lsp/defines"
)

type typ_ struct {
Expand Down
2 changes: 1 addition & 1 deletion go-lsp/lsp/option.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package lsp

import "pls/go-lsp/lsp/defines"
import "github.com/lasorda/protobuf-language-server/go-lsp/lsp/defines"

type Options struct {
// if Network is null, will use stdio
Expand Down
4 changes: 2 additions & 2 deletions go-lsp/lsp/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import (
"net"
"reflect"

"pls/go-lsp/jsonrpc"
"pls/go-lsp/logs"
"github.com/lasorda/protobuf-language-server/go-lsp/jsonrpc"
"github.com/lasorda/protobuf-language-server/go-lsp/logs"
)

type Server struct {
Expand Down
2 changes: 1 addition & 1 deletion go-lsp/lsp/stdio.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"io"
"os"

"pls/go-lsp/jsonrpc"
"github.com/lasorda/protobuf-language-server/go-lsp/jsonrpc"
)

type stdioReaderWriter struct {
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module pls
module github.com/lasorda/protobuf-language-server

go 1.16

Expand Down
12 changes: 6 additions & 6 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ import (
"os"
"path"

"pls/components"
"pls/proto/view"
"github.com/lasorda/protobuf-language-server/components"
"github.com/lasorda/protobuf-language-server/proto/view"

"pls/go-lsp/logs"
"pls/go-lsp/lsp"
"pls/go-lsp/lsp/defines"
"github.com/lasorda/protobuf-language-server/go-lsp/logs"
"github.com/lasorda/protobuf-language-server/go-lsp/lsp"
"github.com/lasorda/protobuf-language-server/go-lsp/lsp/defines"
)

func strPtr(str string) *string {
Expand All @@ -29,7 +29,7 @@ func init() {
if err != nil {
home = ""
}
logPath = flag.String("logs", path.Join(home, ".pls.log"), "logs file path")
logPath = flag.String("logs", path.Join(home, ".protobuf-language-server.log"), "logs file path")
if logPath == nil || *logPath == "" {
logger = log.New(os.Stderr, "", 0)
return
Expand Down
2 changes: 1 addition & 1 deletion proto/parser/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package parser
import (
"io"

"pls/go-lsp/lsp/defines"
"github.com/lasorda/protobuf-language-server/go-lsp/lsp/defines"
protobuf "github.com/emicklei/proto"
)

Expand Down
4 changes: 2 additions & 2 deletions proto/parser/proto.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package parser
import (
"sync"

"pls/go-lsp/logs"
"pls/go-lsp/lsp/defines"
"github.com/lasorda/protobuf-language-server/go-lsp/logs"
"github.com/lasorda/protobuf-language-server/go-lsp/lsp/defines"
protobuf "github.com/emicklei/proto"
)

Expand Down
4 changes: 2 additions & 2 deletions proto/view/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import (
"context"
"strings"

"pls/proto/parser"
"github.com/lasorda/protobuf-language-server/proto/parser"

"pls/go-lsp/lsp/defines"
"github.com/lasorda/protobuf-language-server/go-lsp/lsp/defines"
)

// File represents a source file of any type.
Expand Down
8 changes: 4 additions & 4 deletions proto/view/view.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ import (
"sync"
"unicode/utf8"

"pls/go-lsp/logs"
"pls/go-lsp/lsp"
"pls/go-lsp/lsp/defines"
"github.com/lasorda/protobuf-language-server/go-lsp/logs"
"github.com/lasorda/protobuf-language-server/go-lsp/lsp"
"github.com/lasorda/protobuf-language-server/go-lsp/lsp/defines"
"go.lsp.dev/jsonrpc2"
"go.lsp.dev/uri"

"pls/proto/parser"
"github.com/lasorda/protobuf-language-server/proto/parser"
)

type view struct {
Expand Down
2 changes: 1 addition & 1 deletion vscode-extension/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ A language server implementation for Google Protocol Buffers
## how to use

1. Get code from [https://github.com/lasorda/protobuf-language-server](https://github.com/lasorda/protobuf-language-server)
2. Build the target `pls`, add `pls` to `PATH`
2. Build the target `protobuf-language-server`, add `protobuf-language-server` to `PATH`

## features

Expand Down
4 changes: 2 additions & 2 deletions vscode-extension/src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ import {
export function activate(context: ExtensionContext) {
// The server is implemented in node
// const serverModule = context.asAbsolutePath(
// path.join('bin', 'pls')
// path.join('bin', 'protobuf-language-server')
// );
const serverModule = 'pls';
const serverModule = 'protobuf-language-server';
// let debugOptions = { execArgv: ["--nolazy", "--debug=6004"] };
// If the extension is launched in debug mode then the debug server options are used
// Otherwise the run options are used
Expand Down

0 comments on commit 10ce9d5

Please sign in to comment.