Improve OpenCode

This commit is contained in:
Krzosa Karol
2026-01-05 14:52:00 +01:00
parent 8c0c9c82f1
commit 8f4d3a218f
3 changed files with 14 additions and 8 deletions

View File

@@ -9,6 +9,8 @@
- ctrl-e started doing no-ops again ... ??
- Window position: vscode opens in fullscreen and then remembers what position it was close in (could be a config option)
- On Linux: Try to implement is_debugger_present()
- Probably shouldn't emit (Key pressed when ctrl etc. is not clicked!!)
- Brace, bracket, paren indenting?
- OnUpdate view hooks!
- OnSave buffer hooks which will execute the config on save

View File

@@ -832,20 +832,24 @@ void CMD_SetWorkDirHere() {
} RegisterCommand(CMD_SetWorkDirHere, "", "Sets work directory to the directory of the current buffer, it also renames couple special buffers to make them accomodate the new WorkDir");
void Coro_OpenCode(mco_coro *co) {
Array<String> patterns = Split(CoCurr->arena, OpenCodeCommandExcludePatterns, "|");
Array<String> patterns = SplitWhitespace(CoCurr->arena, OpenCodePatterns);
Array<String> dirs = {CoCurr->arena};
String *param_dir = (String *)CoCurr->user_ctx;
Add(&dirs, *param_dir);
for (int diri = 0; diri < dirs.len; diri += 1) {
for (FileIter it = IterateFiles(CoCurr->arena, dirs[diri]); IsValid(it); Advance(&it)) {
bool match = false;
if (!it.is_directory) {
bool should_open = false;
ForItem (ending, patterns) {
if (EndsWith(it.absolute_path, ending)) {
match = true;
should_open = true;
break;
}
}
if (match) continue;
if (!should_open) {
continue;
}
}
if (it.is_directory) {

View File

@@ -167,7 +167,7 @@ RegisterVariable(String, WindowsVCVarsPathToLoadDevEnviroment, "C:/Program Files
RegisterVariable(Float, UndoMergeTime, 0.3);
RegisterVariable(Float, JumpHistoryMergeTime, 0.3);
RegisterVariable(String, InternetBrowser, "firefox");
RegisterVariable(String, OpenCodeCommandExcludePatterns, ".git/|.obj|.o|.pdb|.exe|.ilk|.ttf|.ico|.gif|.jpg|.png|.spall|.dll|.so|.a|.lib|SDL/");
RegisterVariable(String, OpenCodePatterns, ".c .h .cpp .hpp .cc .cxx .rs .go .zig .py .lua .js .ts .jsx .tsx .java .kt .swift .cs .rb .php .html .css .scss .sh .bash .zsh .sql .asm .s .cmake .make .json .yaml .toml .ini .txt .md .rst .Makefile .Dockerfile .gitignore .bashrc .zshrc");
RegisterVariable(Int, TrimTrailingWhitespace, 1);
RegisterVariable(Int, FormatCode, 0);
RegisterVariable(Int, SetModifiesConfig, 1);