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

VSC Integration: Syntax highlight & code assist #746

Closed
josephjclark opened this issue Aug 15, 2024 · 6 comments
Closed

VSC Integration: Syntax highlight & code assist #746

josephjclark opened this issue Aug 15, 2024 · 6 comments
Assignees

Comments

@josephjclark
Copy link
Collaborator

josephjclark commented Aug 15, 2024

Step 1 for VSC integration:

  • Create an extension which adds OpenFn JS language support
  • Associate with .ofn files (you can of course manually set any .js file to use the extension)
  • If there is an adaptor declaration at the top (// @openfn/languge<lang>[@<version>), download that adaptor and extract the .dts
  • Expose those typings to the Typescript engine (like we do in Monaco)

This gets us almost to parity with Lightning in VSC, with code completions provided by the adaptor. No magic functions yet though.

Can we detect an openfn project and then assume that all js is openfn js?

@github-project-automation github-project-automation bot moved this to New Issues in v2 Aug 15, 2024
@josephjclark
Copy link
Collaborator Author

For now (maybe temporary, maybe not) we'll create a .openfnrc file as a hook to tell VSC that there' an openfn project here

@josephjclark
Copy link
Collaborator Author

josephjclark commented Dec 16, 2024

  1. use a declaration like "use common@latest" to associate an adaptor with a js file and provide code assist
  2. add syntax highlighting to openfn js files
  3. detect an openfn project (TODO: provide one or two sample project structures)
  4. Infer adaptors in js files from a parenting project.yaml or workflow.json (whichever comes first)

We use .openfnrc right now to "bootstrap" an openfn project. Use JSON or ESM internally to store data

Hard-code any values we need into .openfnrc - including paths to workflow.json or whatever. Don't worry too much for now about the dynamics of it

If in an openfn project, assume that all JS files are openfn code

@doc-han
Copy link
Collaborator

doc-han commented Dec 19, 2024

I'm suggesting .fn instead of .ofn

@josephjclark
Copy link
Collaborator Author

.fn is better! But I think we can just .js, no?

@doc-han
Copy link
Collaborator

doc-han commented Dec 20, 2024

.fn is better! But I think we can just .js, no?

Yeah we can

@josephjclark
Copy link
Collaborator Author

I think I prefer .js because its close enough and more normal. But I change my mind all the time! and .fn is way better than .ofn and the other suggestions (.ojs)

So let's say this:

Let's add support for .fn, so that people can use it if they want (the CLI will need a light update to support it but don't worry about that yet). That would auto-associate with the openfn language so that's easy for you to implement.

But let's also make sure that a .js file associated with a workflow.json or project.yaml is recognised as an openfn language. That's probably much harder. You can use .openfnrc to explicitly recognise files if it helps.

I don't care at this point in what order things happen - we're in a rough spiking/exploration phase and I'm more interested in scoping out what's possible than settling fine implementation details.

@github-project-automation github-project-automation bot moved this from New Issues to Done in v2 Jan 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

No branches or pull requests

2 participants