File indexing completed on 2024-03-24 04:00:37
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 namespace KTextEditor 0010 { 0011 class DocumentPrivate; 0012 }; 0013 0014 /** 0015 * File indentation detecter. Mostly ported from VSCode to here 0016 */ 0017 class KateIndentDetecter 0018 { 0019 public: 0020 struct Result { 0021 /** 0022 * If indentation is based on spaces (`insertSpaces` = true), then what is the number of spaces that make an indent? 0023 */ 0024 int indentWidth = 4; 0025 /** 0026 * Is indentation based on spaces? 0027 */ 0028 bool indentUsingSpaces = true; 0029 }; 0030 0031 KateIndentDetecter(KTextEditor::DocumentPrivate *doc); 0032 0033 Result detect(int defaultTabSize, bool defaultInsertSpaces); 0034 0035 private: 0036 KTextEditor::DocumentPrivate *m_doc; 0037 }; 0038 0039 #endif