mirror of
https://github.com/golang/go
synced 2024-11-18 16:44:43 -07:00
internal/lsp: disable rangeFormatting temporarily
RangeFormatting was broken with the introduction of the diff library, but not noticed until golang/go#31150. Temporarily disable this behavior until we fix it. Change-Id: Ie3e50a763e0c0e8672ad20c3a2e37d901325d356 Reviewed-on: https://go-review.googlesource.com/c/tools/+/175938 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
9529901698
commit
5658f888b3
@ -67,11 +67,13 @@ func (f *format) Run(ctx context.Context, args ...string) error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
p := protocol.DocumentRangeFormattingParams{
|
if loc.Range.Start != loc.Range.End {
|
||||||
TextDocument: protocol.TextDocumentIdentifier{URI: loc.URI},
|
return fmt.Errorf("only full file formatting supported")
|
||||||
Range: loc.Range,
|
|
||||||
}
|
}
|
||||||
edits, err := server.RangeFormatting(ctx, &p)
|
p := protocol.DocumentFormattingParams{
|
||||||
|
TextDocument: protocol.TextDocumentIdentifier{URI: loc.URI},
|
||||||
|
}
|
||||||
|
edits, err := server.Formatting(ctx, &p)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("%v: %v", spn, err)
|
return fmt.Errorf("%v: %v", spn, err)
|
||||||
}
|
}
|
||||||
|
@ -20,20 +20,6 @@ func (s *Server) formatting(ctx context.Context, params *protocol.DocumentFormat
|
|||||||
return formatRange(ctx, view, spn)
|
return formatRange(ctx, view, spn)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Server) rangeFormatting(ctx context.Context, params *protocol.DocumentRangeFormattingParams) ([]protocol.TextEdit, error) {
|
|
||||||
uri := span.NewURI(params.TextDocument.URI)
|
|
||||||
view := s.findView(ctx, uri)
|
|
||||||
_, m, err := newColumnMap(ctx, view, uri)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
spn, err := m.RangeSpan(params.Range)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return formatRange(ctx, view, spn)
|
|
||||||
}
|
|
||||||
|
|
||||||
// formatRange formats a document with a given range.
|
// formatRange formats a document with a given range.
|
||||||
func formatRange(ctx context.Context, v source.View, s span.Span) ([]protocol.TextEdit, error) {
|
func formatRange(ctx context.Context, v source.View, s span.Span) ([]protocol.TextEdit, error) {
|
||||||
f, m, err := newColumnMap(ctx, v, s.URI())
|
f, m, err := newColumnMap(ctx, v, s.URI())
|
||||||
|
@ -78,13 +78,12 @@ func (s *Server) initialize(ctx context.Context, params *protocol.InitializePara
|
|||||||
CompletionProvider: &protocol.CompletionOptions{
|
CompletionProvider: &protocol.CompletionOptions{
|
||||||
TriggerCharacters: []string{"."},
|
TriggerCharacters: []string{"."},
|
||||||
},
|
},
|
||||||
DefinitionProvider: true,
|
DefinitionProvider: true,
|
||||||
DocumentFormattingProvider: true,
|
DocumentFormattingProvider: true,
|
||||||
DocumentRangeFormattingProvider: true,
|
DocumentSymbolProvider: true,
|
||||||
DocumentSymbolProvider: true,
|
HoverProvider: true,
|
||||||
HoverProvider: true,
|
DocumentHighlightProvider: true,
|
||||||
DocumentHighlightProvider: true,
|
DocumentLinkProvider: &protocol.DocumentLinkOptions{},
|
||||||
DocumentLinkProvider: &protocol.DocumentLinkOptions{},
|
|
||||||
SignatureHelpProvider: &protocol.SignatureHelpOptions{
|
SignatureHelpProvider: &protocol.SignatureHelpOptions{
|
||||||
TriggerCharacters: []string{"(", ","},
|
TriggerCharacters: []string{"(", ","},
|
||||||
},
|
},
|
||||||
|
@ -231,7 +231,7 @@ func (s *Server) Formatting(ctx context.Context, params *protocol.DocumentFormat
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *Server) RangeFormatting(ctx context.Context, params *protocol.DocumentRangeFormattingParams) ([]protocol.TextEdit, error) {
|
func (s *Server) RangeFormatting(ctx context.Context, params *protocol.DocumentRangeFormattingParams) ([]protocol.TextEdit, error) {
|
||||||
return s.rangeFormatting(ctx, params)
|
return nil, notImplemented("RangeFormatting")
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Server) OnTypeFormatting(context.Context, *protocol.DocumentOnTypeFormattingParams) ([]protocol.TextEdit, error) {
|
func (s *Server) OnTypeFormatting(context.Context, *protocol.DocumentOnTypeFormattingParams) ([]protocol.TextEdit, error) {
|
||||||
|
Loading…
Reference in New Issue
Block a user