Skip to content

Commit 50800d1

Browse files
committed
fix: v2.3.6 基本功能修复和更新;
1 parent 9f439dc commit 50800d1

52 files changed

Lines changed: 5793 additions & 2647 deletions

Some content is hidden

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

CMakeLists.txt

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ else()
1717
endif()
1818

1919
set(CMAKE_CXX_STANDARD_REQUIRED ON)
20-
set(PROJECT_VERSION "2.3.5")
20+
set(PROJECT_VERSION "2.3.6")
2121

2222
find_package(Qt6 REQUIRED COMPONENTS Widgets Network Concurrent PrintSupport
2323
Xml LinguistTools)
@@ -158,8 +158,18 @@ set(SNIPPET_GRAMMAR
158158
src/grammar/Snippet/SnippetBaseVisitor.h
159159
src/grammar/Snippet/SnippetBaseVisitor.cpp)
160160

161+
set(ANGELSCRIPTEXP_SRC
162+
src/grammar/AngelscriptExprParser/AngelscriptExprParserBaseVisitor.h
163+
src/grammar/AngelscriptExprParser/AngelscriptExprParserLexer.h
164+
src/grammar/AngelscriptExprParser/AngelscriptExprParserParser.h
165+
src/grammar/AngelscriptExprParser/AngelscriptExprParserVisitor.h
166+
src/grammar/AngelscriptExprParser/AngelscriptExprParserBaseVisitor.cpp
167+
src/grammar/AngelscriptExprParser/AngelscriptExprParserLexer.cpp
168+
src/grammar/AngelscriptExprParser/AngelscriptExprParserParser.cpp
169+
src/grammar/AngelscriptExprParser/AngelscriptExprParserVisitor.cpp)
170+
161171
set(ANTLR4_GRAMMAR ${NUMCAL_GRAMMAR} ${CSTRUCT_GRAMMAR} ${ASCONSOLE_GRAMMAR}
162-
${SNIPPET_GRAMMAR})
172+
${SNIPPET_GRAMMAR} ${ANGELSCRIPTEXP_SRC})
163173

164174
set(ANGEL_SCRIPT_ADDON_ROOT
165175
"${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/AngelScript/sdk/add_on")
@@ -350,6 +360,8 @@ set(CLASS_SRC
350360
src/class/asbuilder.cpp
351361
src/class/aspreprocesser.h
352362
src/class/aspreprocesser.cpp
363+
src/class/asexprevaluator.h
364+
src/class/asexprevaluator.cpp
353365
src/class/layoutmanager.h
354366
src/class/layoutmanager.cpp
355367
src/class/cryptographichash.h

lang/en_US/winghex_en_US.ts

Lines changed: 477 additions & 477 deletions
Large diffs are not rendered by default.

lang/zh_CN/winghex_zh_CN.ts

Lines changed: 477 additions & 477 deletions
Large diffs are not rendered by default.

lang/zh_TW/winghex_zh_TW.ts

Lines changed: 477 additions & 477 deletions
Large diffs are not rendered by default.

src/class/angellsp.cpp

Lines changed: 27 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,6 @@ QJsonValue AngelLsp::initializeSync(int timeoutMs) {
176176
QJsonObject params;
177177
params["processId"] = QCoreApplication::applicationPid();
178178

179-
// capabilities minimal
180179
QJsonObject caps;
181180
QJsonObject workspace;
182181
workspace["configuration"] = false;
@@ -186,8 +185,9 @@ QJsonValue AngelLsp::initializeSync(int timeoutMs) {
186185
QJsonObject sync;
187186
sync["dynamicRegistration"] = false;
188187
td["synchronization"] = sync;
188+
td["semanticTokens"] = buildSemanticTokensClientCapability();
189189
caps["textDocument"] = td;
190-
params["capabilities"] = buildSemanticTokensClientCapability();
190+
params["capabilities"] = caps;
191191

192192
auto r = sendRequestSync(QStringLiteral("initialize"), params, timeoutMs);
193193
updateSemanticTokensCapabilities(r["capabilities"]);
@@ -354,7 +354,7 @@ AngelLsp::decodeSemanticTokenData(const QVector<quint32> &raw,
354354

355355
for (int bit = 0; bit < legend.tokenModifiers.size(); ++bit) {
356356
if (modifierMask & (1u << bit))
357-
token.modifiers.append(legend.tokenModifiers[bit]);
357+
token.modifiers.append(legend.tokenModifiers[bit + 1]);
358358
}
359359

360360
out.push_back(std::move(token));
@@ -483,10 +483,10 @@ QJsonObject AngelLsp::buildSemanticTokensClientCapability() {
483483
"macro", "label", "comment", "string", "keyword",
484484
"number", "regexp", "operator", "keywordControl"};
485485

486-
semanticTokens["tokenModifiers"] =
487-
QJsonArray{"declaration", "definition", "readonly", "static",
488-
"deprecated", "abstract", "async", "modification",
489-
"documentation", "defaultLibrary"};
486+
semanticTokens["tokenModifiers"] = QJsonArray{
487+
"declaration", "definition", "readonly", "static",
488+
"deprecated", "abstract", "async", "modification",
489+
"documentation", "defaultLibrary", "inactive"};
490490

491491
semanticTokens["formats"] = QJsonArray{QStringLiteral("relative")};
492492
semanticTokens["overlappingTokenSupport"] = false;
@@ -804,7 +804,7 @@ void AngelLsp::handleIncomingMessage(const QJsonObject &msg) {
804804
o["suppressAnalyzerErrors"] = true;
805805
o["includePath"] = QJsonArray();
806806
o["implicitMutualInclusion"] = false;
807-
o["hoistEnumParentScope"] = false;
807+
o["hoistEnumParentScope"] = true;
808808
o["explicitPropertyAccessor"] = true;
809809
o["allowUnicodeIdentifiers"] = true;
810810
o["supportsForEach"] = true;
@@ -813,6 +813,19 @@ void AngelLsp::handleIncomingMessage(const QJsonObject &msg) {
813813
o["supportsDigitSeparators"] = true;
814814
o["builtinStringType"] = "string";
815815
o["builtinArrayType"] = "array";
816+
o["excludeDirectiveProcessPatterns"] =
817+
QJsonArray{"dev://as_console", "dev://as_console_mt"};
818+
819+
QJsonArray syms;
820+
for (auto &&sym : m_defines.asKeyValueRange()) {
821+
if (sym.second.isEmpty()) {
822+
syms.append(sym.first);
823+
} else {
824+
syms.append(QString(sym.first + '=' + sym.second));
825+
}
826+
}
827+
o["definedSymbols"] = syms;
828+
816829
QJsonObject fmt;
817830
fmt["maxBlankLines"] = 1;
818831
fmt["indentSpaces"] = _indentSpace;
@@ -824,9 +837,8 @@ void AngelLsp::handleIncomingMessage(const QJsonObject &msg) {
824837
trace["server"] = e.valueToKey(int(_traceMode));
825838
o["trace"] = trace;
826839

827-
QJsonArray j;
828-
j.append(Utilities::getASPredefPath());
829-
o["forceIncludePredefined"] = j;
840+
o["forceIncludePredefined"] =
841+
QJsonArray{Utilities::getASPredefPath()};
830842

831843
result.append(o);
832844

@@ -1006,3 +1018,7 @@ void AngelLsp::setAutofmt(bool newAutofmt) {
10061018
_autofmt = newAutofmt;
10071019
}
10081020
}
1021+
1022+
void AngelLsp::defineMacroWord(const QString &word, const QString &value) {
1023+
m_defines.insert(word, value);
1024+
}

src/class/angellsp.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,8 @@ private slots:
167167
bool autofmt() const;
168168
void setAutofmt(bool newAutofmt);
169169

170+
void defineMacroWord(const QString &word, const QString &value = {});
171+
170172
private:
171173
struct SemanticTokenCache {
172174
QString resultId;
@@ -189,6 +191,8 @@ private slots:
189191
// Debounce/coalesce document change support
190192
QHash<QString, QTimer *> m_docTimers; // per-document debouncers
191193

194+
QHash<QString, QString> m_defines;
195+
192196
private:
193197
// configures
194198
TraceMode _traceMode = TraceMode::off;

src/class/appmanager.cpp

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,6 @@ AppManager::AppManager(int &argc, char *argv[])
123123
if (openFile(param, true, false, &isWs) !=
124124
WingHex::Success) {
125125
failedFile.append(param);
126-
} else {
127-
_w->addRecentFile(param, isWs);
128126
}
129127
}
130128
_w->show();
@@ -147,8 +145,6 @@ AppManager::AppManager(int &argc, char *argv[])
147145
bool isWs;
148146
if (openFile(file, true, false, &isWs) != WingHex::Success) {
149147
failedFile.append(file);
150-
} else {
151-
_w->addRecentFile(file, isWs);
152148
}
153149
}
154150

@@ -189,9 +185,7 @@ ErrFile AppManager::openFile(const QString &file, bool autoDetect,
189185
EditorView *editor = nullptr;
190186
Q_ASSERT(_w);
191187

192-
if (isWorkSpace) {
193-
*isWorkSpace = false;
194-
}
188+
bool isWS = false;
195189

196190
ErrFile ret = ErrFile::Error;
197191
if (autoDetect) {
@@ -200,8 +194,8 @@ ErrFile AppManager::openFile(const QString &file, bool autoDetect,
200194
auto suffix = finfo.suffix();
201195
if (suffix.compare(QStringLiteral("wingpro")) == 0) {
202196
ret = _w->openWorkSpace(file, &editor);
203-
if (isWorkSpace && ret == ErrFile::Success) {
204-
*isWorkSpace = true;
197+
if (ret == ErrFile::Success) {
198+
isWS = true;
205199
}
206200
} else if (!skipScripting &&
207201
suffix.compare(QStringLiteral("as")) == 0) {
@@ -210,6 +204,7 @@ ErrFile AppManager::openFile(const QString &file, bool autoDetect,
210204
}
211205
}
212206
}
207+
213208
if (ret == ErrFile::Error) {
214209
ret = _w->openFile(file, &editor);
215210

@@ -222,6 +217,9 @@ ErrFile AppManager::openFile(const QString &file, bool autoDetect,
222217
}
223218

224219
editor->setFocus();
220+
_w->addRecentFile(nullptr, file);
221+
} else if (ret == ErrFile::Success) {
222+
_w->addRecentFile(editor, file);
225223
}
226224
} else if (ret == ErrFile::AlreadyOpened) {
227225
Q_ASSERT(editor);
@@ -232,6 +230,11 @@ ErrFile AppManager::openFile(const QString &file, bool autoDetect,
232230
}
233231

234232
editor->setFocus();
233+
_w->addRecentFile(nullptr, file, isWS);
234+
}
235+
236+
if (isWorkSpace) {
237+
*isWorkSpace = isWS;
235238
}
236239

237240
return ret;

src/class/ascompletion.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -190,8 +190,8 @@ bool AsCompletion::processTrigger(const QString &trigger,
190190
QList<CodeInfoTip> AsCompletion::parseMarcos() {
191191
static QList<CodeInfoTip> marcos;
192192
if (marcos.isEmpty()) {
193-
QStringList m{"define", "undef", "if", "else", "endif",
194-
"ifdef", "ifndef", "include", "pragma"};
193+
QStringList m{"if", "else", "endif", "ifdef",
194+
"ifndef", "include", "pragma"};
195195
for (const auto &i : m) {
196196
CodeInfoTip tip;
197197
tip.name = i;

0 commit comments

Comments
 (0)