File indexing completed on 2024-04-28 11:45:34

0001 /*
0002     SPDX-FileCopyrightText: 2022 Waqar Ahmed <waqar.17a@gmail.com>
0003 
0004     SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 #ifndef KATE_INDENT_DETECTER_H
0007 #define KATE_INDENT_DETECTER_H
0008 
0009 #include <katedocument.h>
0010 
0011 /**
0012  * File indentation detecter. Mostly ported from VSCode to here
0013  */
0014 class KateIndentDetecter
0015 {
0016 public:
0017     struct Result {
0018         /**
0019          * If indentation is based on spaces (`insertSpaces` = true), then what is the number of spaces that make an indent?
0020          */
0021         int indentWidth = 4;
0022         /**
0023          * Is indentation based on spaces?
0024          */
0025         bool indentUsingSpaces = true;
0026     };
0027 
0028     KateIndentDetecter(KTextEditor::DocumentPrivate *doc);
0029 
0030     Result detect(int defaultTabSize, bool defaultInsertSpaces);
0031 
0032 private:
0033     KTextEditor::DocumentPrivate *m_doc;
0034 };
0035 
0036 #endif