Skip to content

Commit 83813e2

Browse files
committed
refactor file path, clean up code
1 parent e101f09 commit 83813e2

File tree

120 files changed

+290
-298
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

120 files changed

+290
-298
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ if(APPLE)
2222
endif ()
2323

2424
add_subdirectory(LuaParser)
25-
add_subdirectory(CodeService)
25+
add_subdirectory(CodeFormatCore)
2626
add_subdirectory(Util)
2727

2828
if(BuildAsLuaLib)

CodeFormat/CMakeLists.txt

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,22 @@
1-
cmake_minimum_required(VERSION 3.11)
1+
cmake_minimum_required(VERSION 3.14)
22

33
project(CodeFormat)
44

5-
add_executable(CodeFormat ../include/CodeService/Format/Analyzer/FormatDocAnalyze.h)
5+
add_executable(CodeFormat)
66

77
add_dependencies(CodeFormat CodeService Util)
88

9-
target_include_directories(CodeFormat PUBLIC
10-
${LuaCodeStyle_SOURCE_DIR}/include
9+
target_include_directories(CodeFormat PRIVATE
1110
src
1211
)
1312

1413
target_sources(CodeFormat
15-
PUBLIC
16-
${CodeFormat_SOURCE_DIR}/src/CodeFormat.cpp
17-
${CodeFormat_SOURCE_DIR}/src/LuaFormat.cpp
14+
PRIVATE
15+
src/CodeFormat.cpp
16+
src/LuaFormat.cpp
1817
)
1918

20-
target_link_libraries(CodeFormat CodeService Util)
19+
target_link_libraries(CodeFormat PUBLIC CodeService Util)
2120

2221
if(CMAKE_SYSTEM_NAME STREQUAL Linux)
2322
target_link_libraries(CodeFormat -static-libstdc++ -static-libgcc)

CodeFormat/src/LuaFormat.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@
33
#include <fstream>
44
#include <sstream>
55
#include "Util/format.h"
6-
#include "CodeService/Config/LuaEditorConfig.h"
6+
#include "CodeFormatCore/Config/LuaEditorConfig.h"
77
#include "Util/StringUtil.h"
88
#include "LuaParser/File/LuaFile.h"
99
#include "LuaParser/Types/TextRange.h"
1010
#include "LuaParser/Lexer/LuaLexer.h"
1111
#include "LuaParser/Ast/LuaSyntaxTree.h"
12-
#include "CodeService/Format/FormatBuilder.h"
12+
#include "CodeFormatCore/Format/FormatBuilder.h"
1313
#include "LuaParser/Parse/LuaParser.h"
14-
#include "CodeService/Diagnostic/DiagnosticBuilder.h"
14+
#include "CodeFormatCore/Diagnostic/DiagnosticBuilder.h"
1515
#include "Util/FileFinder.h"
1616
#include "Util/Url.h"
1717

CodeFormat/src/LuaFormat.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55
#include <filesystem>
66
#include <cstring>
77
#include <optional>
8-
#include "CodeService/Config/LuaStyle.h"
8+
#include "CodeFormatCore/Config/LuaStyle.h"
99
#include "LuaParser/File/LuaFile.h"
1010
#include "LuaParser/Types/TextRange.h"
1111
#include "Types.h"
12-
#include "CodeService/Config/LuaDiagnosticStyle.h"
12+
#include "CodeFormatCore/Config/LuaDiagnosticStyle.h"
1313

1414
class LuaFormat {
1515
public:

CodeFormat/src/Types.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
#include <string_view>
44
#include <memory>
5-
#include "CodeService/Config/LuaEditorConfig.h"
5+
#include "CodeFormatCore/Config/LuaEditorConfig.h"
66

77

88
struct LuaConfig {

CodeFormatCore/CMakeLists.txt

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
cmake_minimum_required(VERSION 3.14)
2+
3+
project(CodeService)
4+
5+
add_library(CodeService STATIC)
6+
7+
add_dependencies(CodeService LuaParser Util)
8+
9+
target_include_directories(CodeService
10+
PUBLIC
11+
include
12+
PRIVATE
13+
src
14+
)
15+
16+
target_sources(CodeService
17+
PRIVATE
18+
# config
19+
src/Config/FunctionOption.cpp
20+
src/Config/LuaStyle.cpp
21+
src/Config/LuaEditorConfig.cpp
22+
src/Config/LuaDiagnosticStyle.cpp
23+
src/Config/LanguageTranslator.cpp
24+
src/Config/EditorconfigPattern.cpp
25+
26+
# format
27+
src/Format/FormatBuilder.cpp
28+
src/Format/FormatState.cpp
29+
src/Format/Analyzer/FormatAnalyzer.cpp
30+
src/Format/Analyzer/SpaceAnalyzer.cpp
31+
src/Format/Analyzer/IndentationAnalyzer.cpp
32+
src/Format/Analyzer/LineBreakAnalyzer.cpp
33+
src/Format/Analyzer/FormatDocAnalyze.cpp
34+
src/Format/Analyzer/AlignAnalyzer.cpp
35+
src/Format/Analyzer/TokenAnalyzer.cpp
36+
src/Format/Analyzer/FormatResolve.cpp
37+
src/Format/Analyzer/SyntaxNodeHelper.cpp
38+
# rangeFormat
39+
src/RangeFormat/RangeFormatBuilder.cpp
40+
# typeFormat
41+
src/TypeFormat/LuaTypeFormat.cpp
42+
src/TypeFormat/LuaTypeFormatOptions.cpp
43+
# diagnostic
44+
src/Diagnostic/DiagnosticBuilder.cpp
45+
# diagnostic/nameStyle
46+
src/Diagnostic/NameStyle/NameStyleChecker.cpp
47+
src/Diagnostic/NameStyle/NameStyleRuleMatcher.cpp
48+
# diagnostic/spell
49+
src/Diagnostic/Spell/CodeSpellChecker.cpp
50+
src/Diagnostic/Spell/IdentifyParser.cpp
51+
src/Diagnostic/Spell/TextParser.cpp
52+
# diagnostic/codestyle
53+
src/Diagnostic/CodeStyle/CodeStyleChecker.cpp
54+
)
55+
56+
if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
57+
target_compile_options(CodeService PUBLIC /utf-8)
58+
endif ()
59+
60+
target_link_libraries(CodeService LuaParser Util)

include/CodeService/Config/EditorconfigPattern.h renamed to CodeFormatCore/include/CodeFormatCore/Config/EditorconfigPattern.h

File renamed without changes.

include/CodeService/Config/LanguageTranslator.h renamed to CodeFormatCore/include/CodeFormatCore/Config/LanguageTranslator.h

File renamed without changes.

include/CodeService/Config/LuaDiagnosticStyle.h renamed to CodeFormatCore/include/CodeFormatCore/Config/LuaDiagnosticStyle.h

File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)