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

[Swift] Initial support #3918

Open
FichteFoll opened this issue Feb 6, 2024 · 7 comments
Open

[Swift] Initial support #3918

FichteFoll opened this issue Feb 6, 2024 · 7 comments

Comments

@FichteFoll
Copy link
Collaborator

FichteFoll commented Feb 6, 2024

What happened?

There were several attempts to add a Swift syntax to the default packages before, but they failed because the quality of the syntax definitions were not up to par and there was not enough movement behind them to get them to a passable level (#11). Since the previous issue tracking this (#253) was closed, I'm opening a new one to gather community support, ideas, and to collect references.

Previous (publicly accessible) work:

Going forward

The most promising Swift language definition was recently (2024-01) added to Package Control under the name of "Swift Next" and is maintained by @yaroslavyaroslav at https://github.com/Swift-Next/Swift-Next and was originally created by @aerobounce. @yaroslavyaroslav also voiced his support for eventually adding the package to the default packages and offered to help with that.

@jrappen
Copy link
Contributor

jrappen commented Mar 5, 2024

@FichteFoll maybe pin this, too?

@michaelblyons michaelblyons pinned this issue Mar 5, 2024
@yaroslavyaroslav
Copy link

So just to mention, there are few quite serious issues with the syntax that are spread across the whole its code, like this one for instance.

This exact one is occurred because of func definition takes anything that matches .whatever(. So it'd take a lot of effort to make things right even with the tests provided.

So I'd like to get acknowledged with DoD of this task from your perspective. Because if they're quite strict this will leads not just to adding a tests with some minor bug fixes meanwhile, but to some general refactoring.

@FichteFoll
Copy link
Collaborator Author

FichteFoll commented Mar 12, 2024

As I mentioned on Discord previously, in my opinion we can merge into a develop/ branch first and continue iterating on it until it has reached a certain level of maturity to be included as a default package1. However, we would at least need some tests for the initial state to prevent regressions. They don't need to be as detailed as some of the tests we already have here, but should at least cover the basic functionality like some keywords, function definitions and various other basic syntax constructs.

Footnotes

  1. which has no definition by itself and basically just requires two approvals by collaborators

@yaroslavyaroslav
Copy link

yaroslavyaroslav commented Mar 26, 2024

Just an update of the swift syntax journey here.

  1. It's Swift 6 coming this summer, which would has a breaking changes in syntax in it's release. So I believe it's worth to halt a test implementing process (which is barely started, lol) till at least I'll be able to look at those changes closer. The one that definitely would bring a mess there is an typed throw, and I believe the more to come.
  2. I've implemented though quite raw yet iOS build system wrapper above sublime's Default.exec one. Building and launching iOS/macOS projects from without Xcode is a huge pain in the ass, that capturing a dozen number of steps to complete, but here we are.

@yaroslavyaroslav
Copy link

@FichteFoll speaking about syntax testing. One difficulty that I struggling with is the absence of knowledge "What's the right scope from ST should be really set on a given clause", i.e. the source of truth absence.

Recently we've got fixed LSP-Sourcekit semantic highlighting feature, so now LSP server sends its tokens, i.e. here's the source of truth coming.

So I look forward to rely on semantic highlight as a source of truth. Is a good practice here? Maybe you see some flaws along the path right away?

Here's the example of tokens provided by lsp server.

request.setValue(apiKey, forHTTPHeaderField: "x-api-key")
// <- variable
//       <- method, defaultLibrary

@jrappen
Copy link
Contributor

jrappen commented Apr 27, 2024

I can send you a small PR to get you started with syntax testing in general if that helps.

You should only test what is defined in the syntax within the same repository. If you got stuff missing there but you want to take parts from LSP-Sourcekit, you should add (both) the syntax definition (as well as tests for it).

@yaroslavyaroslav
Copy link

I can send you a small PR to get you started with syntax testing in general if that helps.

Yeah, I'd really appreciate that

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants