Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions IDE/src/Compiler/BfParser.bf
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ namespace IDE.Compiler
public int32 mTextVersion = -1;
public bool mIsUserRequested;
public bool mDoFuzzyAutoComplete;
public bool mShouldAutoCompleteIgnoreNamespaces;
public Stopwatch mStopwatch ~ delete _;
public ProfileInstance mProfileInstance ~ _.Dispose();

Expand Down Expand Up @@ -168,7 +169,7 @@ namespace IDE.Compiler
static extern char8* BfParser_GetDebugExpressionAt(void* bfParser, int32 cursorIdx);

[CallingConvention(.Stdcall), CLink]
static extern void* BfParser_CreateResolvePassData(void* bfSystem, int32 resolveType, bool doFuzzyAutoComplete);
static extern void* BfParser_CreateResolvePassData(void* bfSystem, int32 resolveType, bool doFuzzyAutoComplete, bool shouldAutoCompleteIgnoreNamespaces);

[CallingConvention(.Stdcall), CLink]
static extern bool BfParser_BuildDefs(void* bfParser, void* bfPassInstance, void* bfResolvePassData, bool fullRefresh);
Expand Down Expand Up @@ -328,10 +329,10 @@ namespace IDE.Compiler
BfParser_GenerateAutoCompletionFrom(mNativeBfParser, srcPosition);
}

public BfResolvePassData CreateResolvePassData(ResolveType resolveType = ResolveType.Autocomplete, bool doFuzzyAutoComplete = false)
public BfResolvePassData CreateResolvePassData(ResolveType resolveType = ResolveType.Autocomplete, bool doFuzzyAutoComplete = false, bool shouldAutoCompleteIgnoreNamespaces = false)
{
var resolvePassData = new BfResolvePassData();
resolvePassData.mNativeResolvePassData = BfParser_CreateResolvePassData(mNativeBfParser, (int32)resolveType, doFuzzyAutoComplete);
resolvePassData.mNativeResolvePassData = BfParser_CreateResolvePassData(mNativeBfParser, (int32)resolveType, doFuzzyAutoComplete, shouldAutoCompleteIgnoreNamespaces);
return resolvePassData;
}

Expand Down
4 changes: 2 additions & 2 deletions IDE/src/Compiler/BfResolvePassData.bf
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,10 @@ namespace IDE.Compiler
BfResolvePassData_SetDocumentationRequest(mNativeResolvePassData, entryName);
}

public static BfResolvePassData Create(ResolveType resolveType = ResolveType.Autocomplete, bool doFuzzyAutoComplete = false)
public static BfResolvePassData Create(ResolveType resolveType = ResolveType.Autocomplete, bool doFuzzyAutoComplete = false, bool shouldAutoCompleteIgnoreNamespaces = false)
{
var resolvePassData = new BfResolvePassData();
resolvePassData.mNativeResolvePassData = BfParser.[Friend]BfParser_CreateResolvePassData(null, (int32)resolveType, doFuzzyAutoComplete);
resolvePassData.mNativeResolvePassData = BfParser.[Friend]BfParser_CreateResolvePassData(null, (int32)resolveType, doFuzzyAutoComplete, shouldAutoCompleteIgnoreNamespaces);
return resolvePassData;
}

Expand Down
3 changes: 3 additions & 0 deletions IDE/src/Settings.bf
Original file line number Diff line number Diff line change
Expand Up @@ -729,6 +729,7 @@ namespace IDE
public bool mAutoCompleteOnEnter = true;
public bool mAutoCompleteShowDocumentation = true;
public bool mFuzzyAutoComplete = false;
public bool mShouldAutoCompleteIgnoreNamespaces = false;
public bool mShowLocatorAnim = true;
public bool mHiliteCursorReferences = true;
public bool mDebugMultiCursor = false;
Expand Down Expand Up @@ -764,6 +765,7 @@ namespace IDE
sd.Add("AutoCompleteOnEnter", mAutoCompleteOnEnter);
sd.Add("AutoCompleteShowDocumentation", mAutoCompleteShowDocumentation);
sd.Add("FuzzyAutoComplete", mFuzzyAutoComplete);
sd.Add("ShouldAutoCompleteIgnoreNamespaces", mShouldAutoCompleteIgnoreNamespaces);
sd.Add("ShowLocatorAnim", mShowLocatorAnim);
sd.Add("HiliteCursorReferences", mHiliteCursorReferences);
sd.Add("HiliteCurrentLine", mHiliteCurrentLine);
Expand Down Expand Up @@ -801,6 +803,7 @@ namespace IDE
sd.Get("AutoCompleteOnEnter", ref mAutoCompleteOnEnter);
sd.Get("AutoCompleteShowDocumentation", ref mAutoCompleteShowDocumentation);
sd.Get("FuzzyAutoComplete", ref mFuzzyAutoComplete);
sd.Get("ShouldAutoCompleteIgnoreNamespaces", ref mShouldAutoCompleteIgnoreNamespaces);
sd.Get("ShowLocatorAnim", ref mShowLocatorAnim);
sd.Get("HiliteCursorReferences", ref mHiliteCursorReferences);
sd.Get("HiliteCurrentLine", ref mHiliteCurrentLine);
Expand Down
1 change: 1 addition & 0 deletions IDE/src/ui/SettingsDialog.bf
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ namespace IDE.ui
AddPropertiesItem(category, "Autocomplete on Enter", "mAutoCompleteOnEnter");
AddPropertiesItem(category, "Autocomplete Show Documentation", "mAutoCompleteShowDocumentation");
AddPropertiesItem(category, "Fuzzy Autocomplete", "mFuzzyAutoComplete");
AddPropertiesItem(category, "Autocomplete Unimported Items", "mShouldAutoCompleteIgnoreNamespaces");
AddPropertiesItem(category, "Show Locator Animation", "mShowLocatorAnim");
AddPropertiesItem(category, "Hilite Symbol at Cursor", "mHiliteCursorReferences");
AddPropertiesItem(category, "Hilite Current Line", "mHiliteCurrentLine");
Expand Down
4 changes: 3 additions & 1 deletion IDE/src/ui/SourceViewPanel.bf
Original file line number Diff line number Diff line change
Expand Up @@ -762,6 +762,7 @@ namespace IDE.ui
resolveParams.mProfileInstance = Profiler.StartSampling("Autocomplete").GetValueOrDefault();
resolveParams.mIsUserRequested = options.HasFlag(.UserRequested);
resolveParams.mDoFuzzyAutoComplete = gApp.mSettings.mEditorSettings.mFuzzyAutoComplete;
resolveParams.mShouldAutoCompleteIgnoreNamespaces = gApp.mSettings.mEditorSettings.mShouldAutoCompleteIgnoreNamespaces;
Classify(.Autocomplete, resolveParams);
if (!resolveParams.mInDeferredList)
delete resolveParams;
Expand Down Expand Up @@ -2209,8 +2210,9 @@ namespace IDE.ui
}

bool doFuzzyAutoComplete = resolveParams?.mDoFuzzyAutoComplete ?? false;
bool shouldAutoCompleteIgnoreNamespaces = resolveParams?.mShouldAutoCompleteIgnoreNamespaces ?? false;

var resolvePassData = parser.CreateResolvePassData(resolveType, doFuzzyAutoComplete);
var resolvePassData = parser.CreateResolvePassData(resolveType, doFuzzyAutoComplete, shouldAutoCompleteIgnoreNamespaces);
if (resolveParams != null)
{
if (resolveParams.mLocalId != -1)
Expand Down
9 changes: 6 additions & 3 deletions IDEHelper/Compiler/BfAutoComplete.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ void AutoCompleteBase::Clear()

//////////////////////////////////////////////////////////////////////////

BfAutoComplete::BfAutoComplete(BfResolveType resolveType, bool doFuzzyAutoComplete)
BfAutoComplete::BfAutoComplete(BfResolveType resolveType, bool doFuzzyAutoComplete, bool shouldAutoCompleteIgnoreNamespaces)
{
mResolveType = resolveType;
mModule = NULL;
Expand All @@ -202,6 +202,7 @@ BfAutoComplete::BfAutoComplete(BfResolveType resolveType, bool doFuzzyAutoComple
mIsAutoComplete = (resolveType == BfResolveType_Autocomplete);

mDoFuzzyAutoComplete = doFuzzyAutoComplete;
mShouldAutoCompleteIgnoreNamespaces = shouldAutoCompleteIgnoreNamespaces;

mGetDefinitionNode = NULL;
mShowAttributeProperties = NULL;
Expand Down Expand Up @@ -1475,7 +1476,8 @@ void BfAutoComplete::AddTopLevelNamespaces(BfAstNode* identifierNode)
for (auto namespacePair : project->mNamespaces)
{
const BfAtomComposite& namespaceComposite = namespacePair.mKey;
if (namespaceComposite.GetPartsCount() == 1)
if ((mShouldAutoCompleteIgnoreNamespaces) ||
(namespaceComposite.GetPartsCount() == 1))
{
AddEntry(AutoCompleteEntry("namespace", namespaceComposite.ToString()), filter);
}
Expand Down Expand Up @@ -1587,7 +1589,8 @@ void BfAutoComplete::AddTopLevelTypes(BfAstNode* identifierNode, bool onlyAttrib
bool matches = false;
if (typeDef->mOuterType == NULL)
{
if (((typeDef->mNamespace.IsEmpty()) ||
if ((mShouldAutoCompleteIgnoreNamespaces) ||
((typeDef->mNamespace.IsEmpty()) ||
(namespaceSearch.Contains(typeDef->mNamespace))))
matches = true;
}
Expand Down
3 changes: 2 additions & 1 deletion IDEHelper/Compiler/BfAutoComplete.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ class AutoCompleteBase
bool mIsGetDefinition;
bool mIsAutoComplete;
bool mDoFuzzyAutoComplete;
bool mShouldAutoCompleteIgnoreNamespaces;
int mInsertStartIdx;
int mInsertEndIdx;

Expand Down Expand Up @@ -248,7 +249,7 @@ class BfAutoComplete : public AutoCompleteBase
String ConstantToString(BfIRConstHolder* constHolder, BfTypedValue typedValue);

public:
BfAutoComplete(BfResolveType resolveType = BfResolveType_Autocomplete, bool doFuzzyAutoComplete = false);
BfAutoComplete(BfResolveType resolveType = BfResolveType_Autocomplete, bool doFuzzyAutoComplete = false, bool shouldAutoCompleteIgnoreNamespaces = false);
~BfAutoComplete();

void SetModule(BfModule* module);
Expand Down
4 changes: 2 additions & 2 deletions IDEHelper/Compiler/BfParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4252,14 +4252,14 @@ BF_EXPORT const char* BF_CALLTYPE BfParser_GetDebugExpressionAt(BfParser* bfPars
return outString.c_str();
}

BF_EXPORT BfResolvePassData* BF_CALLTYPE BfParser_CreateResolvePassData(BfParser* bfParser, BfResolveType resolveType, bool doFuzzyAutoComplete)
BF_EXPORT BfResolvePassData* BF_CALLTYPE BfParser_CreateResolvePassData(BfParser* bfParser, BfResolveType resolveType, bool doFuzzyAutoComplete, bool shouldAutoCompleteIgnoreNamespaces)
{
auto bfResolvePassData = new BfResolvePassData();
bfResolvePassData->mResolveType = resolveType;
if (bfParser != NULL)
bfResolvePassData->mParsers.Add(bfParser);
if ((bfParser != NULL) && ((bfParser->mParserFlags & ParserFlag_Autocomplete) != 0))
bfResolvePassData->mAutoComplete = new BfAutoComplete(resolveType, doFuzzyAutoComplete);
bfResolvePassData->mAutoComplete = new BfAutoComplete(resolveType, doFuzzyAutoComplete, shouldAutoCompleteIgnoreNamespaces);
return bfResolvePassData;
}

Expand Down