ExcludePatterns for OpenCode
This commit is contained in:
@@ -2,7 +2,6 @@
|
||||
! From a user (novice) point of view, how does it look like?
|
||||
|
||||
- We need regex for: [FormatCode matching, IsCode matching,
|
||||
- Project config
|
||||
- IndentKind has issues with stuff still like cleaning whitespace etc.
|
||||
- Remedybg commands integrated! (like clicking f5 and opening up the window)
|
||||
- Macros
|
||||
|
||||
@@ -833,24 +833,34 @@ void CMD_SetWorkDirHere() {
|
||||
|
||||
void Coro_OpenCode(mco_coro *co) {
|
||||
Array<String> patterns = SplitWhitespace(CoCurr->arena, OpenCodePatterns);
|
||||
Array<String> exclude_patterns = SplitWhitespace(CoCurr->arena, OpenCodeExcludePatterns);
|
||||
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 should_open = true;
|
||||
if (!it.is_directory) {
|
||||
bool should_open = false;
|
||||
should_open = false;
|
||||
ForItem (ending, patterns) {
|
||||
if (EndsWith(it.absolute_path, ending)) {
|
||||
should_open = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!should_open) {
|
||||
continue;
|
||||
}
|
||||
|
||||
ForItem (ending, exclude_patterns) {
|
||||
if (EndsWith(it.absolute_path, ending)) {
|
||||
should_open = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!should_open) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
if (it.is_directory) {
|
||||
Add(&dirs, it.absolute_path);
|
||||
|
||||
@@ -168,6 +168,7 @@ RegisterVariable(Float, UndoMergeTime, 0.3);
|
||||
RegisterVariable(Float, JumpHistoryMergeTime, 0.3);
|
||||
RegisterVariable(String, InternetBrowser, "firefox");
|
||||
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(String, OpenCodeExcludePatterns, "");
|
||||
RegisterVariable(Int, TrimTrailingWhitespace, 1);
|
||||
RegisterVariable(Int, FormatCode, 0);
|
||||
RegisterVariable(Int, SetModifiesConfig, 1);
|
||||
Reference in New Issue
Block a user