1 // Copyright 2018 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
10 "golang.org/x/tools/internal/lsp/mod"
11 "golang.org/x/tools/internal/lsp/protocol"
12 "golang.org/x/tools/internal/lsp/source"
15 func (s *Server) formatting(ctx context.Context, params *protocol.DocumentFormattingParams) ([]protocol.TextEdit, error) {
16 snapshot, fh, ok, release, err := s.beginFileRequest(ctx, params.TextDocument.URI, source.UnknownKind)
23 return mod.Format(ctx, snapshot, fh)
25 return source.Format(ctx, snapshot, fh)