More work on making intellisense work

This commit is contained in:
2025-06-16 21:32:40 -04:00
parent 80ff7d7d92
commit be45f55222
9 changed files with 35 additions and 25 deletions

View File

@@ -41,10 +41,11 @@
"C_Cpp.intelliSenseEngine": "disabled",
"clangd.path": "/usr/bin/clangd-15",
"clangd.arguments": [
"--query-driver=/usr/bin/g++",
"--compile-commands-dir=[INTEGRATION]/.vscode",
"--header-insertion=never"
],
"C_Cpp.autocomplete": "Disabled"
"C_Cpp.autocomplete": "disabled"
},
"extensions": {
"recommendations": [

View File

@@ -263,10 +263,14 @@ def build_intellisense_database_for_clangd(force):
create_tarfile(f"{INTEGRATION}/Intermediate", "*.rsp", f"{INTEGRATION}/rsp_files.tgz")
create_tarfile(f"{UNREALENGINE}/Engine", "*.rsp", f"{UNREALENGINE}/rsp_files.tgz")
try:
shell(INTEGRATION, f"{UNREALENGINE}/Engine/Build/BatchFiles/{BUILD_BAT} -waitmutex IntegrationEditor {OS} DebugGame {INTEGRATION}/Integration.uproject -mode=GenerateClangDatabase -OutputDir={UNREALENGINE}/.vscode")
Path(f"{INTEGRATION}/.vscode/compile_commands.json").unlink(missing_ok=True)
shell(INTEGRATION, f"{UNREALENGINE}/Engine/Build/BatchFiles/{BUILD_BAT} -waitmutex IntegrationEditor {OS} DebugGame {INTEGRATION}/Integration.uproject -mode=GenerateClangDatabase -OutputDir={INTEGRATION}/.vscode")
shell(UNREALENGINE, f"{UNREALENGINE}/Engine/Build/BatchFiles/{BUILD_BAT} -waitmutex UnrealEditor {OS} DebugGame -mode=GenerateClangDatabase -OutputDir={UNREALENGINE}/.vscode")
shell(INTEGRATION, f"cat {UNREALENGINE}/.vscode/compile_commands.json >> {INTEGRATION}/.vscode/compile_commands.json")
shell(INTEGRATION, f"cat {INTEGRATION}/luprex/build/{OS}/compile_commands.json >> {INTEGRATION}/.vscode/compile_commands.json")
cc1 = json.loads(Path(f"{INTEGRATION}/.vscode/compile_commands.json").read_text())
cc2 = json.loads(Path(f"{INTEGRATION}/luprex/build/{OS}/compile_commands.json").read_text())
cc3 = json.loads(Path(f"{UNREALENGINE}/.vscode/compile_commands.json").read_text())
cc = cc1 + cc2 + cc3
Path(f"{INTEGRATION}/.vscode/compile_commands.json").write_text(json.dumps(cc, indent=2))
except Exception as e:
error = e
else:

View File

@@ -34,7 +34,7 @@ ifeq "$(OS)" "Linux"
LINKEXE:=g++ -Wall $(OPT) -std=c++20 -export-dynamic -o
MAKEDEPS:=true
LIBS:=-L./ext/openssl-3.0.1/lib/linux -lssl -lcrypto -ldl
CCJSON="build/$(OS)/compile_commands.json"
CCJSON:=build/$(OS)/compile_commands.json
FLAGS_ERIS:=-DLUA_USE_APICHECK -DLUA_USE_POSIX
FLAGS_CORE:=-I./ext/eris-master/src -I./cpp/wrap -I./cpp/core -I./ext
@@ -60,7 +60,7 @@ ifeq "$(OS)" "Windows"
LINKEXE:=CL $(OPT) /std:c++20 /EHsc /nologo /Fe:
MAKEDEPS:=g++ -Wall -std=c++20 -MMD -E -o
LIBS:=ext/openssl-3.1.0/lib/visual/libcrypto.lib ext/openssl-3.1.0/lib/visual/libssl.lib ws2_32.lib crypt32.lib cryptui.lib user32.lib advapi32.lib
CCJSON="build/$(OS)/compile_commands.json"
CCJSON:=build/$(OS)/compile_commands.json
FLAGS_ERIS:=-DLUA_USE_APICHECK -DLUA_COMPAT_ALL
FLAGS_CORE:=-I./ext/eris-master/src -I./cpp/wrap -I./cpp/core -I./ext
@@ -132,7 +132,7 @@ build/$(OS)/drv/%.obj: cpp/drv/%.cpp build/$(OS)/DIRECTORY
$(COMPILE) $@ $(FLAGS_DRV) $<
$(CCJSON): Makefile add-compile-commands.py
rm -rf $(CCJSON)
echo "[]" > $(CCJSON)
python3 ./add-compile-commands.py "$(CCJSON)" "$(COMPILE)" "$(FLAGS_ERIS)" "build/$(OS)/eris/FILE.obj" "ext/eris-master/src/FILE.c" $(BASE_ERIS)
python3 ./add-compile-commands.py "$(CCJSON)" "$(COMPILE)" "$(FLAGS_CORE)" "build/$(OS)/cpp/FILE.obj" "cpp/core/FILE.cpp" $(BASE_CORE)
python3 ./add-compile-commands.py "$(CCJSON)" "$(COMPILE)" "$(FLAGS_DRV)" "build/$(OS)/drv/FILE.obj" "cpp/drv/FILE.cpp" $(BASE_DRV)

View File

@@ -1,23 +1,27 @@
import sys, os
import sys, os, json
from pathlib import Path
LUPREXDIR=os.path.dirname(os.path.abspath(sys.argv[0]))
JSON=sys.argv[1]
JSONFILE=sys.argv[1]
COMPILE=sys.argv[2]
FLAGS=sys.argv[3]
OBJPAT=sys.argv[4]
CPAT=sys.argv[5]
OBJECTS=sys.argv[6:]
with open(JSON, "a") as cc:
for base in OBJECTS:
JSON = json.loads(Path(JSONFILE).read_text())
for base in OBJECTS:
obj = LUPREXDIR + "/" + OBJPAT.replace("FILE", base)
file = LUPREXDIR + "/" + CPAT.replace("FILE", base)
flags = FLAGS.replace("-I./", f"-I{LUPREXDIR}/")
cc.write('{\n')
cc.write(f' "file" : "{file}",\n')
cc.write(f' "command" : "{COMPILE} {obj} {flags} {file}",\n')
cc.write(f' "directory" : "{LUPREXDIR}"\n')
cc.write('}\n')
command = f"{COMPILE} {obj} {flags} {file}"
JSON.append({"file": file, "command": command, "directory": LUPREXDIR })
Path(JSONFILE).write_text(json.dumps(JSON, indent=4))

View File

@@ -219,7 +219,7 @@ enum DrvAction {
PLAY_RELEASE,
};
inline static const char *action_string(DrvAction act) {
[[maybe_unused]] inline static const char *action_string(DrvAction act) {
switch(act) {
case PLAY_INITIALIZE: return "PLAY_INITIALIZE";
case PLAY_CLEAR_NEW_OUTGOING: return "PLAY_CLEAR_NEW_OUTGOING";
@@ -233,6 +233,7 @@ inline static const char *action_string(DrvAction act) {
default: return "unknown";
}
}
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
//

View File

@@ -169,7 +169,6 @@ namespace eng {
void *operator new(size_t size)
{
assert(false && "not supposed to 'new' this class");
return NULL;
}
void operator delete(void *p, size_t size)
@@ -180,7 +179,6 @@ namespace eng {
void *operator new[](size_t size)
{
assert(false && "not supposed to 'new' this class");
return NULL;
}
void operator delete[](void *p, size_t size)

View File

@@ -15,6 +15,9 @@
#ifndef ENGINEWRAPPER_H
#define ENGINEWRAPPER_H
#include <cstdint>
#include <cstddef>
#define DRV_MAX_CHAN 256
#define DRV_MAX_LISTEN_PORTS 256
#define DRV_ERRMSG_SIZE 8192

View File

@@ -687,7 +687,7 @@ HttpServerResponse World::http_serve(const HttpParser &request) {
}
// Get the name of the desired function.
std::string_view orig_fn = request.first_path_component("index");
eng::string orig_fn = request.first_path_component("index");
eng::string lua_fn = HttpParser::to_lua_identifier(orig_fn);
if (lua_fn.empty()) {
response.fail(404, util::ss("cannot convert to lua function name: ", orig_fn));

View File

@@ -9,8 +9,7 @@
namespace eng {
template<class C, class T=std::char_traits<C>>
class basic_ostringstream : public std::basic_ostringstream<C, T, eng::allocator<C>>, public eng::opnew {
using underlying = std::basic_ostringstream<C, T, eng::allocator<C>>;
using underlying::basic_ostringstream;
using std::basic_ostringstream<C, T, eng::allocator<C>>::basic_ostringstream;
};
//template<class C, class T=std::char_traits<C>>
//using basic_stringbuf = std::basic_stringbuf<C, T, eng::allocator<C>>;