( ctx context.Context, documentURI lsproto.DocumentUri, options *lsproto.FormattingOptions, position lsproto.Position, character string, )
| 63 | } |
| 64 | |
| 65 | func (l *LanguageService) ProvideFormatDocumentOnType( |
| 66 | ctx context.Context, |
| 67 | documentURI lsproto.DocumentUri, |
| 68 | options *lsproto.FormattingOptions, |
| 69 | position lsproto.Position, |
| 70 | character string, |
| 71 | ) (lsproto.DocumentOnTypeFormattingResponse, error) { |
| 72 | if l.UserPreferences().EnableFormatting.IsFalse() { |
| 73 | return lsproto.TextEditsOrNull{}, nil |
| 74 | } |
| 75 | _, file := l.getProgramAndFile(documentURI) |
| 76 | formatOpts := lsutil.FromLSFormatOptions(l.FormatOptions(), options) |
| 77 | edits := l.toLSProtoTextEdits(file, l.getFormattingEditsAfterKeystroke( |
| 78 | ctx, |
| 79 | file, |
| 80 | formatOpts, |
| 81 | int(l.converters.LineAndCharacterToPosition(file, position)), |
| 82 | character, |
| 83 | )) |
| 84 | return lsproto.TextEditsOrNull{TextEdits: &edits}, nil |
| 85 | } |
| 86 | |
| 87 | func (l *LanguageService) getFormattingEditsForRange( |
| 88 | ctx context.Context, |
no test coverage detected