Implemented both opt-out settings for vscode config load, although enabled by default:

```json
  // autocomplete.json
  {
    "config": {
      "load_vscode_snippets": false
    }
  }

  // debugger.json
  {
    "config": {
      "load_vscode_launch_config": false
    }
  }
```

Disabling them affects only .vscode imports. Personal/.ecode snippets and .ecode/launch.json continue loading normally.

Refs SpartanJ/ecod€#111
This commit is contained in:
Martín Lucas Golini
2026-08-01 01:38:14 -03:00
parent 323d511eed
commit da4d201eeb
5 changed files with 2424 additions and 10 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -384,6 +384,13 @@ void AutoCompletePlugin::load( PluginManager* pluginManager ) {
config["suggestion_documentation"] = mSignatureHelpDocumentation;
updateConfigFile = true;
}
if ( config.contains( "load_vscode_snippets" ) )
mLoadVSCodeSnippets = config.value( "load_vscode_snippets", true );
else {
config["load_vscode_snippets"] = mLoadVSCodeSnippets;
updateConfigFile = true;
}
}
if ( mKeyBindings.empty() ) {
@@ -508,8 +515,9 @@ void AutoCompletePlugin::setSnippetWorkspaceFolder( std::string workspaceFolder
if ( mSnippetWorkspaceFolder == workspaceFolder )
return;
mSnippetWorkspaceFolder = workspaceFolder;
mVSCodeSnippetsPath =
workspaceFolder.empty() ? "" : workspaceFolder + ".vscode" + FileSystem::getOSSlash();
mVSCodeSnippetsPath = workspaceFolder.empty() || !mLoadVSCodeSnippets
? ""
: workspaceFolder + ".vscode" + FileSystem::getOSSlash();
mEcodeSnippetsPath =
workspaceFolder.empty() ? "" : workspaceFolder + ".ecode" + FileSystem::getOSSlash();
generation = ++mSnippetWorkspaceGeneration;
@@ -524,8 +532,9 @@ void AutoCompletePlugin::setSnippetWorkspaceFolder( std::string workspaceFolder
mUserSnippetStore.removeSource( UserSnippetSource::EcodeProject );
if ( workspaceFolder.empty() )
return;
loadSnippetDirectory( workspaceFolder + ".vscode" + FileSystem::getOSSlash(),
UserSnippetSource::VSCodeProject, false );
if ( mLoadVSCodeSnippets )
loadSnippetDirectory( workspaceFolder + ".vscode" + FileSystem::getOSSlash(),
UserSnippetSource::VSCodeProject, false );
loadSnippetDirectory( workspaceFolder + ".ecode" + FileSystem::getOSSlash(),
UserSnippetSource::EcodeProject, false );
} );
@@ -590,7 +599,8 @@ void AutoCompletePlugin::registerSnippetLocatorProvider() {
}
std::string language = editor->getDocument().getSyntaxDefinition().getLSPName();
std::string filePath = editor->getDocument().getFilePath();
FileSystem::filePathRemoveBasePath( getPluginContext()->getCurrentProject(), filePath );
FileSystem::filePathRemoveBasePath( getPluginContext()->getCurrentProject(),
filePath );
std::string pattern = query.toUtf8();
++mSnippetJobs;
mThreadPool->run( [this, language = std::move( language ),
@@ -2587,8 +2597,7 @@ AutoCompletePlugin::getUserSnippetSuggestions( UICodeEditor* editor, const std::
std::string filePath = editor->getDocument().getFilePath();
if ( getPluginContext() )
FileSystem::filePathRemoveBasePath( getPluginContext()->getCurrentProject(), filePath );
auto matches = mUserSnippetStore.find( language, snippetInput, maxResults,
filePath );
auto matches = mUserSnippetStore.find( language, snippetInput, maxResults, filePath );
suggestions.reserve( matches.size() );
for ( auto& match : matches ) {
Suggestion suggestion( LSPCompletionItemKind::Snippet, std::move( match.matchedPrefix ),

View File

@@ -199,6 +199,7 @@ class AutoCompletePlugin : public Plugin {
bool mSignatureHelpMultiLine{ true };
bool mSuggestionDocumentation{ true };
bool mSignatureHelpDocumentation{ true };
bool mLoadVSCodeSnippets{ true };
Float mRowHeight{ 0 };
Rectf mBoxRect;

View File

@@ -476,6 +476,11 @@ void DebuggerPlugin::loadDAPConfig( const std::string& path, bool updateConfigFi
mSilence = config.value( "silent", true );
else if ( updateConfigFile )
config["silent"] = mSilence;
if ( config.contains( "load_vscode_launch_config" ) )
mLoadVSCodeLaunchConfig = config.value( "load_vscode_launch_config", true );
else if ( updateConfigFile )
config["load_vscode_launch_config"] = mLoadVSCodeLaunchConfig;
}
if ( j.contains( "dap" ) ) {
@@ -689,9 +694,12 @@ void DebuggerPlugin::loadProjectConfigurations() {
}
mThreadPool->run( [this] {
std::string config = mProjectPath + ".vscode/launch.json";
if ( FileSystem::fileExists( config ) )
loadProjectConfiguration( config );
std::string config;
if ( mLoadVSCodeLaunchConfig ) {
config = mProjectPath + ".vscode/launch.json";
if ( FileSystem::fileExists( config ) )
loadProjectConfiguration( config );
}
config = mProjectPath + ".ecode/launch.json";
if ( FileSystem::fileExists( config ) )
loadProjectConfiguration( config );

View File

@@ -90,6 +90,7 @@ class DebuggerPlugin : public PluginBase {
bool mFetchGlobals{ false };
bool mChangingBreakpoint{ false };
bool mSilence{ true };
bool mLoadVSCodeLaunchConfig{ true };
bool mBrokenUserConfigFile{ false };
std::string mProjectPath;
std::string mConfigFileError;