MCPcopy Index your code
hub / github.com/bytebase/bytebase / readFile

Method readFile

backend/api/lsp/fs_handler.go:21–31  ·  view source on GitHub ↗
(_ context.Context, uri lsp.DocumentURI)

Source from the content-addressed store, hash-verified

19}
20
21func (h *Handler) readFile(_ context.Context, uri lsp.DocumentURI) ([]byte, error) {
22 if !IsURI(uri) {
23 return nil, &os.PathError{Op: "Open", Path: string(uri), Err: errors.New("unable to read out-of-workspace resource from virtual file system")}
24 }
25 fs := h.GetFS()
26 content, found := fs.get(uri)
27 if !found {
28 return nil, &os.PathError{Op: "Open", Path: string(uri), Err: os.ErrNotExist}
29 }
30 return content, nil
31}
32
33// handleFileSystemRequest handles textDocument/did* requests.
34func (h *Handler) handleFileSystemRequest(ctx context.Context, conn *jsonrpc2.Conn, req *jsonrpc2.Request) (lsp.DocumentURI, bool, error) {

Callers 3

loadJsonFileFunction · 0.80

Calls 3

GetFSMethod · 0.95
IsURIFunction · 0.85
getMethod · 0.45

Tested by

no test coverage detected