1 | /* |
2 | SPDX-FileCopyrightText: 2022 Waqar Ahmed <waqar.17a@gmail.com> |
3 | |
4 | SPDX-License-Identifier: LGPL-2.0-or-later |
5 | */ |
6 | #ifndef KATE_INDENT_DETECTER_H |
7 | #define KATE_INDENT_DETECTER_H |
8 | |
9 | namespace KTextEditor |
10 | { |
11 | class DocumentPrivate; |
12 | }; |
13 | |
14 | /** |
15 | * File indentation detecter. Mostly ported from VSCode to here |
16 | */ |
17 | class KateIndentDetecter |
18 | { |
19 | public: |
20 | struct Result { |
21 | /** |
22 | * If indentation is based on spaces (`insertSpaces` = true), then what is the number of spaces that make an indent? |
23 | */ |
24 | int indentWidth = 4; |
25 | /** |
26 | * Is indentation based on spaces? |
27 | */ |
28 | bool indentUsingSpaces = true; |
29 | }; |
30 | |
31 | KateIndentDetecter(KTextEditor::DocumentPrivate *doc); |
32 | |
33 | Result detect(int defaultTabSize, bool defaultInsertSpaces); |
34 | |
35 | private: |
36 | KTextEditor::DocumentPrivate *m_doc; |
37 | }; |
38 | |
39 | #endif |
40 | |