VCVarsall improvements, reload entire config every time
This commit is contained in:
@@ -66,6 +66,7 @@ Style.ClangFormatOnSave = 0
|
||||
Style.FontSize = 12
|
||||
Style.FontFilter = 0
|
||||
Style.Font = "C:/Windows/Fonts/consola.ttf"
|
||||
Style.VCVarsall = "C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Auxiliary/Build/vcvars64.bat"
|
||||
|
||||
SDLK_CTRL = 1073742048
|
||||
SDLK_PAGE_DOWN = 1073741902
|
||||
@@ -390,4 +391,5 @@ void ReloadStyle() {
|
||||
StyleFontSize = GetStyleInt("FontSize", StyleFontSize);
|
||||
StyleFontFilter = GetStyleInt("FontFilter", StyleFontFilter);
|
||||
StyleFont = GetStyleString("Font", StyleFont);
|
||||
StyleVCVarsall = GetStyleString("VCVarsall", StyleVCVarsall);
|
||||
}
|
||||
@@ -62,4 +62,5 @@ Int StyleTrimWhitespaceOnSave = 1;
|
||||
Int StyleClangFormatOnSave = 0;
|
||||
Int StyleFontSize = 12;
|
||||
Int StyleFontFilter = 0;
|
||||
String StyleFont = "C:/Windows/Fonts/consola.ttf";
|
||||
String StyleFont = "C:/Windows/Fonts/consola.ttf";
|
||||
String StyleVCVarsall = "C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Auxiliary/Build/vcvars64.bat";
|
||||
@@ -414,8 +414,7 @@ int Lua_Play(lua_State *L) {
|
||||
void ReloadStyle();
|
||||
extern String BaseLuaConfig;
|
||||
|
||||
int LoadLuaBuffer(Buffer *lua_buffer) {
|
||||
if (!lua_buffer || lua_buffer->dirty || lua_buffer->change_id == lua_buffer->user_change_id) return false;
|
||||
void LoadLuaBuffer(Buffer *lua_buffer) {
|
||||
ReportConsolef("reloading config: %.*s", FmtString(lua_buffer->name));
|
||||
|
||||
Scratch scratch;
|
||||
@@ -432,23 +431,30 @@ int LoadLuaBuffer(Buffer *lua_buffer) {
|
||||
lua_pop(LuaState, 1);
|
||||
}
|
||||
lua_buffer->user_change_id = lua_buffer->change_id;
|
||||
return true;
|
||||
}
|
||||
|
||||
void ReloadLuaConfigs() {
|
||||
int base_config_reload = LoadLuaBuffer(LuaConfigBuffer);
|
||||
int project_config_reload = LoadLuaBuffer(LuaProjectBuffer);
|
||||
bool reload = false;
|
||||
if (LuaConfigBuffer && !LuaConfigBuffer->dirty && LuaConfigBuffer->change_id != LuaConfigBuffer->user_change_id) {
|
||||
reload = true;
|
||||
}
|
||||
if (LuaProjectBuffer && !LuaProjectBuffer->dirty && LuaProjectBuffer->change_id != LuaProjectBuffer->user_change_id) {
|
||||
reload = true;
|
||||
}
|
||||
if (reload == false) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (base_config_reload || project_config_reload) {
|
||||
ReportConsolef("reloading style variables because config changed");
|
||||
ReloadStyle();
|
||||
ReloadFont(); // @todo: maybe don't reload font if nothing changed
|
||||
For(Windows) {
|
||||
Window *window = it.o;
|
||||
if (!window->visible || window->absolute_position || window->is_title_bar) continue;
|
||||
window->draw_scrollbar = StyleDrawScrollbar;
|
||||
window->draw_line_numbers = StyleDrawLineNumbers;
|
||||
}
|
||||
LoadLuaBuffer(LuaConfigBuffer);
|
||||
LoadLuaBuffer(LuaProjectBuffer);
|
||||
|
||||
ReloadStyle();
|
||||
ReloadFont();
|
||||
For(Windows) {
|
||||
Window *window = it.o;
|
||||
if (!window->visible || window->absolute_position || window->is_title_bar) continue;
|
||||
window->draw_scrollbar = StyleDrawScrollbar;
|
||||
window->draw_line_numbers = StyleDrawLineNumbers;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
-- this is going to output all the enviroment variables into the bar after it executes vcvarsall.
|
||||
-- Sentinel is for separating errors from data
|
||||
"C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars64.bat" amd64 && echo SOME_SENTINEL_VALUE && set
|
||||
|
||||
local id = '"C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvarsall.bat" amd64 && echo SOME_SENTINEL_VALUE && set'
|
||||
local buffer_id = GetBufferID(id)
|
||||
while ProcessIsRunning(id) do coroutine.yield() end
|
||||
|
||||
local string = GetBufferString(buffer_id)
|
||||
local lines = SplitIntoLines(string)
|
||||
Skip past sentinel value
|
||||
Parse the enviroment and then pass that value into new processes
|
||||
@@ -222,8 +222,9 @@ Array<Event> GetEventsForFrame(Allocator allocator) {
|
||||
void Windows_SetupVCVarsall(mco_coro *co) {
|
||||
Scratch scratch;
|
||||
String working_dir = GetActiveMainWindowBufferDir();
|
||||
String buffer_name = GetUniqueBufferName(scratch, working_dir, "+cmd-");
|
||||
View *view = Command_ExecHidden(buffer_name, "\"C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Auxiliary/Build/vcvars64.bat\" && set", working_dir);
|
||||
String buffer_name = GetUniqueBufferName(scratch, working_dir, "+cmd-");
|
||||
String cmd = Format(scratch, "\"%.*s\" && set", FmtString(StyleVCVarsall));
|
||||
View *view = Command_ExecHidden(buffer_name, cmd, working_dir);
|
||||
for (;;) {
|
||||
if (!ProcessIsActive(view->id)) {
|
||||
break;
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
- search
|
||||
- dump text editor state to file, restore state
|
||||
- help menu popup when for example in process buffer, on tile bar buffer and stuff like that
|
||||
- Processing cmd.exe command encoding!!!
|
||||
- shift click inside selection should move the selection
|
||||
- report errors (try showing a window)
|
||||
- proper lister
|
||||
- search
|
||||
|
||||
- adding items to directory should create files on save - it should ask the user (syntax: dir/ | file)
|
||||
- ask user if he really wants to quit even though he has an unsaved buffer - popup window
|
||||
@@ -31,10 +30,7 @@
|
||||
- Cmd should reuse the window which already has the build
|
||||
- escapeing multiple cursor after ctrl + d should put the cursor where it was (probably will need to swap secondary and primary cursor for new cursor
|
||||
|
||||
- open lua file with proper name it should do the work for setting up a project (double-click on desktop)
|
||||
- when do we regen directory buffers?
|
||||
- load project command which loads files and config
|
||||
- global config and local config
|
||||
|
||||
- draw indentation levels like in sublime (those lines) - we render chars one by one so seems relatively easy to figure out if whitespace belongs to beginning of line (make sure to add max value like 40 because of big files)
|
||||
- code sections, visual demarkation if beginning of line has a very specific text + goto next / goto prev section hotkey!
|
||||
|
||||
Reference in New Issue
Block a user