(ctx context.Context)
| 44 | } |
| 45 | |
| 46 | func GetNewLineOrDefaultFromContext(ctx context.Context) string { // TODO: Move into broader LS - more than just the formatter uses the newline editor setting/host new line |
| 47 | opt := GetFormatCodeSettingsFromContext(ctx) |
| 48 | if len(opt.NewLineCharacter) > 0 { |
| 49 | return opt.NewLineCharacter |
| 50 | } |
| 51 | host := ctx.Value(formatNewlineKey).(string) |
| 52 | if len(host) > 0 { |
| 53 | return host |
| 54 | } |
| 55 | return "\n" |
| 56 | } |
| 57 | |
| 58 | func FormatSpan(ctx context.Context, span core.TextRange, file *ast.SourceFile, kind FormatRequestKind) []core.TextChange { |
| 59 | // find the smallest node that fully wraps the range and compute the initial indentation for the node |
no test coverage detected