Skip to content

update #404

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

Open
wants to merge 24 commits into
base: main
Choose a base branch
from
Open

update #404

wants to merge 24 commits into from

Conversation

xuhuanzy
Copy link
Member

@xuhuanzy xuhuanzy commented Apr 25, 2025

fixes #406
fixes #407
fixes #393
fixes #330
fixes #369
fixes #373
fixes #374

@xuhuanzy xuhuanzy force-pushed the completion branch 5 times, most recently from cba0680 to 774acdb Compare April 27, 2025 14:19
@xuhuanzy xuhuanzy requested a review from CppCXY April 28, 2025 02:52
@xuhuanzy xuhuanzy force-pushed the completion branch 3 times, most recently from 651160d to 0672d6b Compare April 29, 2025 09:14
diagnostic_code,
),
);
diagnostic_index.add_file_diagnostic_disabled(analyzer.file_id, DiagnosticCode::All);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

不要添加all字段

signature.resolve_return = SignatureReturnStatus::InferResolve;

if returns.len() == 1 && returns[0].type_ref.is_nil() {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

改变这里的写法

for ty in types.iter() {
if ty.is_nil() {
if (!is_hover && !ty.is_function() && ty.is_nil()) || (is_hover && ty.is_nil()) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这是什么奇妙逻辑

@CppCXY
Copy link
Collaborator

CppCXY commented Apr 29, 2025

把goto implement单列一项PR出来

@CppCXY CppCXY requested a review from Copilot April 29, 2025 11:47
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR updates type operation APIs to pass a database reference (db) into TypeOps functions and updates test cases accordingly, while also refining type‐removal, union formatting, and some alias resolution behaviors.

  • Updated TypeOps API to consistently require a DbIndex parameter.
  • Refactored tests to use temporary type variables.
  • Improved handling for alias types and diagnostic disabling.

Reviewed Changes

Copilot reviewed 65 out of 66 changed files in this pull request and generated no comments.

File Description
crates/emmylua_code_analysis/src/db_index/type/type_ops/test.rs Refactored tests to use local variables and updated TypeOps::apply calls.
crates/emmylua_code_analysis/src/db_index/type/type_ops/remove_type.rs Updated remove_type signature with db parameter and modified union‐removal behavior.
crates/emmylua_code_analysis/src/db_index/type/humanize_type.rs Adjusted union type formatting and added new handling for function types.
Other files (various analyzer and diagnostic modules) Updated calls to TypeOps functions to pass db; overall API consistency improvements.
Files not reviewed (1)
  • crates/emmylua_code_analysis/resources/schema.json: Language not supported
Comments suppressed due to low confidence (3)

crates/emmylua_code_analysis/src/db_index/type/humanize_type.rs:218

  • [nitpick] The formatting branch for union types when both functions and nil are present is not immediately clear. Consider adding an inline comment explaining the rationale behind wrapping the type string in parentheses and appending a '?' in this case.
if has_function && has_nil {

crates/emmylua_code_analysis/src/compilation/analyzer/unresolve/resolve_closure.rs:303

  • [nitpick] The new branch for handling a union of function types in closure resolution is complex. It would be beneficial to include an inline comment clarifying the purpose of merging doc function overloads and how the final parameter types are determined.
LuaType::Union(union_types) => {

crates/emmylua_code_analysis/src/db_index/type/type_ops/remove_type.rs:141

  • Changing the behavior to return Some(LuaType::Nil) when no removed types remain may affect downstream type inference logic. Please confirm that this change in union removal behavior is intentional and that all affected code paths have been updated accordingly.
match types.len() {

@xuhuanzy
Copy link
Member Author

把goto implement单列一项PR出来

拆不出来, 依赖于之前的提交

optimize searcher member implementation
@xuhuanzy xuhuanzy linked an issue Apr 30, 2025 that may be closed by this pull request
@xuhuanzy xuhuanzy requested a review from CppCXY April 30, 2025 03:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment