blob: d37359730ec5815506486ad03a5f257f371f0737 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
#pragma once
#include "../core/slang-basic.h"
#include "slang-workspace-version.h"
#include "slang.h"
namespace Slang
{
struct Edit
{
Index offset;
Index length;
String text;
};
struct TextRange
{
Index offsetStart;
Index offsetEnd;
};
enum class FormatBehavior
{
Standard,
PreserveLineBreak,
};
struct FormatOptions
{
bool enableFormatOnType = true;
String clangFormatLocation;
String style = "file";
String fallbackStyle = "{BasedOnStyle: Microsoft}";
String fileName;
bool allowLineBreakInOnTypeFormatting = false;
bool allowLineBreakInRangeFormatting = false;
FormatBehavior behavior = FormatBehavior::Standard;
};
String findClangFormatTool();
List<TextRange> extractFormattingExclusionRanges(UnownedStringSlice text);
List<Edit> formatSource(
UnownedStringSlice text,
Index lineStart,
Index lineEnd,
Index cursorOffset,
const List<TextRange>& exclusionRanges,
const FormatOptions& options);
} // namespace Slang
|