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

[Improvement]: Provide the from clause snippet when a collection is associated #42392

Open
nipunayf opened this issue Mar 23, 2024 · 0 comments
Labels
Area/Completion Issues related to Language Server Auto Completions Priority/Low Team/LanguageServer Language Server Implementation related issues. #Compiler Type/Improvement

Comments

@nipunayf
Copy link
Contributor

Description

Provide the from clause snippet when the user writes collectionVariable.from as well, similar to how the LS provides the foreach snippet for such cases.

Describe your problem(s)

image

The foreach snippet produces the following code.

public function main() {
    int[] arr = [];

    foreach int item in arr {
        
    }
}

Similarly, we can provide a such snippet when the user type arr.from as well.

Describe your solution(s)

The respective completion item should be provided for the following cursor position.

public function main() {
    int[] arr = [];

    arr.from<CURSOR>
}

Similar to how the LS provides the form clause snippet for the from keyword, it can produce the same snippet with a collection attached to it. For instance, arr.from can be converted to from int item in arr.

image

Related area

-> Compilation

Related issue(s) (optional)

No response

Suggested label(s) (optional)

No response

Suggested assignee(s) (optional)

No response

@nipunayf nipunayf added Type/Improvement Priority/Low Team/LanguageServer Language Server Implementation related issues. #Compiler Area/Completion Issues related to Language Server Auto Completions labels Mar 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area/Completion Issues related to Language Server Auto Completions Priority/Low Team/LanguageServer Language Server Implementation related issues. #Compiler Type/Improvement
Projects
None yet
Development

No branches or pull requests

1 participant