cmd/gopls: rename "golsp" to "gopls", as in "Go Please"
Change-Id: Ie5688759ce21bffa6745eb86ef3606639e3ce335 Reviewed-on: https://go-review.googlesource.com/c/158197 Run-TryBot: Rebecca Stambler <rstambler@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Cottrell <iancottrell@google.com>
This commit is contained in:
parent
c3e1567727
commit
b258f6da23
|
@ -2,6 +2,11 @@
|
|||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// -----------------------------------------------------------------
|
||||
// WARNING: golsp has been renamed to gopls (see cmd/gopls/main.go).
|
||||
// This file will be deleted soon.
|
||||
// -----------------------------------------------------------------
|
||||
|
||||
// The golsp command is an LSP server for Go.
|
||||
// The Language Server Protocol allows any text editor
|
||||
// to be extended with IDE-like features;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// The forward command writes and reads to a golsp server on a network socket.
|
||||
// The forward command writes and reads to a gopls server on a network socket.
|
||||
package main
|
||||
|
||||
import (
|
|
@ -1,7 +1,7 @@
|
|||
# golsp testing extension
|
||||
# gopls testing extension
|
||||
|
||||
An extension for debugging the Go Language Server provided by
|
||||
https://golang.org/x/tools/cmd/golsp. The code for this extension comes from
|
||||
https://golang.org/x/tools/cmd/gopls. The code for this extension comes from
|
||||
a combination of
|
||||
https://github.com/Microsoft/vscode-extension-samples/blob/master/lsp-sample
|
||||
and https://github.com/Microsoft/vscode-go.
|
||||
|
@ -18,4 +18,4 @@ and https://github.com/Microsoft/vscode-go.
|
|||
To package the extension, run `vsce package` from this directory. To install
|
||||
the extension, navigate to the "Extensions" panel in VSCode, and select
|
||||
"Install from VSIX..." from the menu in the top right corner. Choose the
|
||||
`golsp-1.0.0.vsix file` and reload VSCode.
|
||||
`gopls-1.0.0.vsix file` and reload VSCode.
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"name": "golsp",
|
||||
"name": "gopls",
|
||||
"description": "Go Language Server Client for testing",
|
||||
"author": "The Go authors",
|
||||
"license": "SEE LICENSE IN ../../../../LICENSE",
|
||||
|
@ -35,21 +35,21 @@
|
|||
},
|
||||
"contributes": {
|
||||
"configuration": {
|
||||
"title": "Go LSP",
|
||||
"title": "gopls",
|
||||
"properties": {
|
||||
"golsp.flags": {
|
||||
"gopls.flags": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
},
|
||||
"default": [],
|
||||
"description": "Flags to pass to golsp",
|
||||
"description": "Flags to pass to gopls",
|
||||
"scope": "resource"
|
||||
},
|
||||
"golsp.command": {
|
||||
"gopls.command": {
|
||||
"type": "string",
|
||||
"default": "golsp",
|
||||
"description": "Name of the GoLSP binary",
|
||||
"default": "gopls",
|
||||
"description": "Name of the gopls binary",
|
||||
"scope": "resource"
|
||||
}
|
||||
}
|
|
@ -11,11 +11,11 @@ import path = require('path');
|
|||
|
||||
export function activate(ctx: vscode.ExtensionContext): void {
|
||||
let document = vscode.window.activeTextEditor.document;
|
||||
let config = vscode.workspace.getConfiguration('golsp', document.uri);
|
||||
let golspCommand: string = config['command'];
|
||||
let golspFlags: string[] = config['flags'];
|
||||
let config = vscode.workspace.getConfiguration('gopls', document.uri);
|
||||
let goplsCommand: string = config['command'];
|
||||
let goplsFlags: string[] = config['flags'];
|
||||
let serverOptions:
|
||||
lsp.ServerOptions = {command: getBinPath(golspCommand), args: golspFlags};
|
||||
lsp.ServerOptions = {command: getBinPath(goplsCommand), args: goplsFlags};
|
||||
let clientOptions: lsp.LanguageClientOptions = {
|
||||
initializationOptions: {},
|
||||
documentSelector: ['go'],
|
||||
|
@ -26,7 +26,7 @@ export function activate(ctx: vscode.ExtensionContext): void {
|
|||
},
|
||||
revealOutputChannelOn: lsp.RevealOutputChannelOn.Never,
|
||||
};
|
||||
const c = new lsp.LanguageClient('golsp', serverOptions, clientOptions);
|
||||
const c = new lsp.LanguageClient('gopls', serverOptions, clientOptions);
|
||||
c.onReady().then(() => {
|
||||
const capabilities = c.initializeResult && c.initializeResult.capabilities;
|
||||
if (!capabilities) {
|
|
@ -0,0 +1,21 @@
|
|||
// Copyright 2018 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// The gopls command is an LSP server for Go.
|
||||
// The Language Server Protocol allows any text editor
|
||||
// to be extended with IDE-like features;
|
||||
// see https://langserver.org/ for details.
|
||||
package main // import "golang.org/x/tools/cmd/gopls"
|
||||
|
||||
import (
|
||||
"context"
|
||||
"os"
|
||||
|
||||
"golang.org/x/tools/internal/lsp/cmd"
|
||||
"golang.org/x/tools/internal/tool"
|
||||
)
|
||||
|
||||
func main() {
|
||||
tool.Main(context.Background(), &cmd.Application{}, os.Args[1:])
|
||||
}
|
|
@ -2,7 +2,7 @@
|
|||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// Package cmd handles the golsp command line.
|
||||
// Package cmd handles the gopls command line.
|
||||
// It contains a handler for each of the modes, along with all the flag handling
|
||||
// and the command line output format.
|
||||
package cmd
|
||||
|
@ -27,7 +27,7 @@ type Application struct {
|
|||
}
|
||||
|
||||
// Name implements tool.Application returning the binary name.
|
||||
func (app *Application) Name() string { return "golsp" }
|
||||
func (app *Application) Name() string { return "gopls" }
|
||||
|
||||
// Usage implements tool.Application returning empty extra argument usage.
|
||||
func (app *Application) Usage() string { return "<mode> [mode-flags] [mode-args]" }
|
||||
|
@ -47,7 +47,7 @@ Available modes are:
|
|||
fmt.Fprintf(f.Output(), " %s : %v\n", c.Name(), c.ShortHelp())
|
||||
}
|
||||
fmt.Fprint(f.Output(), `
|
||||
golsp flags are:
|
||||
gopls flags are:
|
||||
`)
|
||||
f.PrintDefaults()
|
||||
}
|
||||
|
@ -71,7 +71,7 @@ func (app *Application) Run(ctx context.Context, args ...string) error {
|
|||
return tool.CommandLineErrorf("Unknown mode %v", mode)
|
||||
}
|
||||
|
||||
// modes returns the set of command modes supported by the golsp tool on the
|
||||
// modes returns the set of command modes supported by the gopls tool on the
|
||||
// command line.
|
||||
// The mode is specified by the first non flag argument.
|
||||
func (app *Application) modes() []tool.Application {
|
||||
|
|
|
@ -26,7 +26,7 @@ import (
|
|||
type Server struct {
|
||||
Logfile string `flag:"logfile" help:"filename to log to. if value is \"auto\", then logging to a default output file is enabled"`
|
||||
Mode string `flag:"mode" help:"no effect"`
|
||||
Port int `flag:"port" help:"port on which to run golsp for debugging purposes"`
|
||||
Port int `flag:"port" help:"port on which to run gopls for debugging purposes"`
|
||||
}
|
||||
|
||||
func (s *Server) Name() string { return "server" }
|
||||
|
@ -51,7 +51,7 @@ func (s *Server) Run(ctx context.Context, args ...string) error {
|
|||
if s.Logfile != "" {
|
||||
filename := s.Logfile
|
||||
if filename == "auto" {
|
||||
filename = filepath.Join(os.TempDir(), fmt.Sprintf("golsp-%d.log", os.Getpid()))
|
||||
filename = filepath.Join(os.TempDir(), fmt.Sprintf("gopls-%d.log", os.Getpid()))
|
||||
}
|
||||
f, err := os.Create(filename)
|
||||
if err != nil {
|
||||
|
|
Loading…
Reference in New Issue