GithubHelp home page GithubHelp logo

awesome-repositories / go-langserver Goto Github PK

View Code? Open in Web Editor NEW

This project forked from sourcegraph/go-langserver

0.0 2.0 0.0 2.52 MB

Go language server to add Go support to editors and other tools that use the Language Server Protocol (LSP)

Home Page: https://sourcegraph.com

License: MIT License

Shell 0.39% Ruby 1.06% Go 98.55%

go-langserver's Introduction

Go Language Server Build Status

go-langserver is a Go language server that speaks Language Server Protocol. It supports editor features such as go-to-definition, hover, and find-references for Go projects.

Open in Sourcegraph

To build and install the standalone go-langserver run

go get -u github.com/sourcegraph/go-langserver

Support

Hover Jump to def Find references Workspace symbols VFS extension Isolated Parallel
Go

InitializationOptions

If you are a client wanting to integrate go-langserver, you can use the following as initializationOptions in your initialize request to adjust the behaviour:

interface GoInitializationOptions {
  /**
   * funcSnippetEnabled enables the returning of argument snippets
   * on `func` completions, eg. func(foo string, arg2 bar).
   * Requires code completion to be enabled.
   *
   * Defaults to true if not specified.
   */
  funcSnippetEnabled?: boolean;

  /**
   * gocodeCompletionEnabled enables code completion feature (using gocode).
   *
   * Defaults to false if not specified.
   */
  gocodeCompletionEnabled?: boolean;

  /**
   * formatTool decides which tool is used to format documents. Supported: goimports and gofmt.
   *
   * Defaults to goimports if not specified.
   */
  formatTool?: "goimports" | "gofmt";

  /**
   * goimportsLocalPrefix sets the local prefix (comma-separated string) that goimports will use.
   *
   * Defaults to empty string if not specified.
   */
  goimportsLocalPrefix?: string;

  /**
   * MaxParallelism controls the maximum number of goroutines that should be used
   * to fulfill requests. This is useful in editor environments where users do
   * not want results ASAP, but rather just semi quickly without eating all of
   * their CPU.
   *
   * Defaults to half of your CPU cores if not specified.
   */
  maxParallelism?: number;

  /**
   * useBinaryPkgCache controls whether or not $GOPATH/pkg binary .a files should
   * be used.
   *
   * Defaults to true if not specified.
   */
  useBinaryPkgCache?: boolean;
}

Profiling

If you run into performance issues while using the language server, it can be very helpful to attach a CPU or memory profile with the issue report. To capture one, first install Go and then:

Capture a heap (memory) profile:

go tool pprof -svg $GOPATH/bin/go-langserver http://localhost:6060/debug/pprof/heap > heap.svg

Capture a CPU profile:

go tool pprof -svg $GOPATH/bin/go-langserver http://localhost:6060/debug/pprof/profile > cpu.svg

Since these capture the active resource usage, it's best to run these commands while the issue is occurring (i.e. while memory or CPU is high).

go-langserver's People

Contributors

aleksi avatar alexsaveliev avatar anjmao avatar berkant avatar beyang avatar chrismwendt avatar ckaznocha avatar contextualist avatar corpix avatar ezeql avatar iamruinous avatar josharian avatar keegancsmith avatar lindaxie-zz avatar lloiser avatar maskray avatar mbana avatar nicksnyder avatar nicot avatar oneofone avatar otto-md avatar pbitty avatar ramya-rao-a avatar seebs avatar slimsag avatar sqs avatar svarlamov avatar uforic avatar vitreuz avatar wbbradley avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.