Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add require path in labelDetails.description #915

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
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
5 changes: 3 additions & 2 deletions src/platform/roblox/RobloxCompletion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ static lsp::CompletionItem createSuggestRequire(const std::string& name, const s

lsp::CompletionItem item;
item.label = name;
item.labelDetails = {std::nullopt, requirePath};
item.kind = lsp::CompletionItemKind::Module;
item.detail = requirePath;
item.documentation = {lsp::MarkupKind::Markdown, codeBlock("luau", documentation) + "\n\n" + path};
Expand Down Expand Up @@ -270,8 +271,8 @@ const char* RobloxPlatform::handleSortText(

// If calling a property on an Instance, then prioritise these properties
else if (auto instanceType = completionGlobals.globalScope->lookupType("Instance");
instanceType && Luau::get<Luau::ClassType>(instanceType->type) && entry.containingClass &&
Luau::isSubclass(entry.containingClass.value(), Luau::get<Luau::ClassType>(instanceType->type)) && !entry.wrongIndexType)
instanceType && Luau::get<Luau::ClassType>(instanceType->type) && entry.containingClass &&
Luau::isSubclass(entry.containingClass.value(), Luau::get<Luau::ClassType>(instanceType->type)) && !entry.wrongIndexType)
{
if (auto it = std::find(std::begin(COMMON_INSTANCE_PROPERTIES), std::end(COMMON_INSTANCE_PROPERTIES), name);
it != std::end(COMMON_INSTANCE_PROPERTIES))
Expand Down
2 changes: 2 additions & 0 deletions tests/AutoImports.test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -664,6 +664,8 @@ TEST_CASE_FIXTURE(Fixture, "auto_imports_of_modules_show_path_name")
REQUIRE_EQ(imports.size(), 2);
CHECK_EQ(imports[0].detail, "ReplicatedStorage.Folder1.Module");
CHECK_EQ(imports[1].detail, "ReplicatedStorage.Folder2.Module");
CHECK_EQ(imports[0].labelDetails->description, "ReplicatedStorage.Folder1.Module");
CHECK_EQ(imports[1].labelDetails->description, "ReplicatedStorage.Folder2.Module");
}

TEST_SUITE_END();
Loading