Giant blob of minor changes
[dotfiles/.git] / .config / coc / extensions / coc-go-data / tools / pkg / mod / golang.org / x / tools / gopls@v0.5.2 / doc / implementation.md
1 # gopls implementation documentation
2
3 This is not intended as a complete description of the implementation, for the most the part the package godoc, code comments and the code itself hold that.
4 Instead this is meant to be a guide into finding parts of the implementation, and understanding some core concepts used throughout the implementation.
5
6 ## View/Session/Cache
7
8 Throughout the code there are references to these three concepts, and they build on each other.
9
10 At the base is the *Cache*. This is the level at which we hold information that is global in nature, for instance information about the file system and its contents.
11
12 Above that is the *Session*, which holds information for a connection to an editor. This layer hold things like the edited files (referred to as overlays).
13
14 The top layer is called the *View*. This holds the configuration, and the mapping to configured packages.
15
16 The purpose of this layering is to allow a single editor session to have multiple views active whilst still sharing as much information as possible for efficiency.
17 In theory if only the View layer existed, the results would be identical, but slower and using more memory.
18
19 ## Code location
20
21 gopls will be developed in the [x/tools] Go repository; the core packages are in [internal/lsp], and the binary and integration tests are located in [gopls].
22
23 Below is a list of the core packages of gopls, and their primary purpose:
24
25 Package | Description
26 --- | ---
27 [gopls] | the main binary, plugins and integration tests
28 [internal/lsp] | the core message handling package
29 [internal/lsp/cache] | the cache layer
30 [internal/lsp/cmd] | the gopls command line layer
31 [internal/lsp/debug] | features to aid in debugging gopls
32 [internal/lsp/protocol] | the lsp protocol layer and wire format
33 [internal/lsp/source] | the core feature implementations
34 [internal/span] | a package for dealing with source file locations
35 [internal/memoize] | a function invocation cache used to reduce the work done
36 [internal/jsonrpc2] | an implementation of the JSON RPC2 specification
37
38 [gopls]: https://github.com/golang/tools/tree/master/gopls
39 [internal/jsonrpc2]: https://github.com/golang/tools/tree/master/internal/jsonrpc2
40 [internal/lsp]: https://github.com/golang/tools/tree/master/internal/lsp
41 [internal/lsp/cache]: https://github.com/golang/tools/tree/master/internal/lsp/cache
42 [internal/lsp/cmd]: https://github.com/golang/tools/tree/master/internal/lsp/cmd
43 [internal/lsp/debug]: https://github.com/golang/tools/tree/master/internal/lsp/debug
44 [internal/lsp/protocol]: https://github.com/golang/tools/tree/master/internal/lsp/protocol
45 [internal/lsp/source]: https://github.com/golang/tools/tree/master/internal/lsp/source
46 [internal/memoize]: https://github.com/golang/tools/tree/master/internal/memoize
47 [internal/span]: https://github.com/golang/tools/tree/master/internal/span
48 [x/tools]: https://github.com/golang/tools