swift-syntax icon indicating copy to clipboard operation
swift-syntax copied to clipboard

WIP: Implement keyword completion based on the syntax tree’s layout

Open ahoppen opened this issue 3 years ago • 5 comments

Depends on https://github.com/apple/swift-syntax/pull/1013 and https://github.com/apple/swift-syntax/pull/1010.


The idea is that we encode enough information as static members of the Syntax nodes that we can figure out which tokens are valid choices at a particular position. The nice part is that once we have all that information, the actual code completion is really short and about 130 lines. The results look pretty promising to me with a few that are due to our syntax tree layout (like suggesting as or -> at the start of an expression because these are valid tokens in an item to a SequenceExpr and we don’t differentiate the first from the following SequenceExpr items. Maybe this also shows areas where we can improve the syntax tree layout.


This is implemented in SwiftParserDiagnsotics for now, I wanted to move it to IDEUtils once that module is introduced by https://github.com/apple/swift-syntax/pull/999.

ahoppen avatar Oct 24 '22 15:10 ahoppen

I want to take this on for gsoc-2024. Are you still open for mentorship?

Emmankoko avatar Feb 22 '24 19:02 Emmankoko

Great to hear that you are interested @Emmankoko. To apply for Google Summer of Code, you need to submit a project proposal once the application period opens. @ktoso just wrote a fairly good summary of how the process works on https://forums.swift.org/t/code-completion-for-keywords-project-interest/70217/4

ahoppen avatar Feb 23 '24 18:02 ahoppen

Great to hear that you are interested @Emmankoko. To apply for Google Summer of Code, you need to submit a project proposal once the application period opens. @ktoso just wrote a fairly good summary of how the process works on https://forums.swift.org/t/code-completion-for-keywords-project-interest/70217/4

I was wondering if you can assist me with a right direction for the project

Emmankoko avatar Feb 23 '24 18:02 Emmankoko

Could you open a discussion on forums.swift.org? This discussions seems better suited for the forums than a GitHub PR.

ahoppen avatar Feb 23 '24 19:02 ahoppen

Could you open a discussion on forums.swift.org? This discussions seems better suited for the forums than a GitHub PR.

opened a simple topic in forum so we can pick it from there

Emmankoko avatar Feb 23 '24 21:02 Emmankoko