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

Support K6' modules #4

Closed
toolforger opened this issue May 9, 2022 · 6 comments
Closed

Support K6' modules #4

toolforger opened this issue May 9, 2022 · 6 comments

Comments

@toolforger
Copy link

Whenever I do foo = http.post(...), IntelliJ complains that http.post is not returning a value and that that's probably an error.
The tooltip refers to a Session.http function, which I suspect is from NodeJS; anyway, it has a completely different signature than K6' Session.

@toolforger
Copy link
Author

I have to apologize for not providing a path to a solution, as I don't know how to tell IntelliJ what library paths to use, and I don't know if K6 has even a published list of functions they provide on each object (in fact that might be different for each K6 installation, so you'd need to provide your plugin with a path to K6' executable, and somehow make that executable spit out all the relevant data that IntelliJ needs.)

@mbolotov
Copy link
Owner

mbolotov commented Jan 5, 2024

Hi Joachim!
My apologizes for the late response.
Usually, IntelliJ does recognize the k6 module type definitions (as long as they are defined as dependenices in package.json):
image

However, if an IntelliJ project does not define a module for your source code, it will not resolve any dependencies and so does not recognize k6 type definitions.
If it's still an issue, could you check if your project defines a module for your k6 scripts?

You can find out if your project has a module by the presence of this sign:
image

@toolforger
Copy link
Author

Unfortunately, I'm not working on the affected project anymore, so I can't confirm.
Thanks for the feedback though. I don't know if this is worth documenting for the plugin, or at least linking to a page that explains these dependency declarations? This would be useful for people who don't know Node's module system (like myself, I'm from a Java background and just wanted to use K6).
Feel free to close if this does not explain the issue well enough that you can actually do a fix; I have lost all mental context of what I was trying to achieve at the time, so I can't help more, unfortunately.

@mbolotov
Copy link
Owner

mbolotov commented Jan 5, 2024

I don't know if this is worth documenting for the plugin, or at least linking to a page that explains these dependency declarations?

there is an official doc page regarding this: https://k6.io/docs/misc/intellisense/

@mbolotov mbolotov closed this as completed Jan 5, 2024
@toolforger
Copy link
Author

Ah nice.
Maybe just put the link into the "Installation" section?

@mbolotov
Copy link
Owner

mbolotov commented Jan 5, 2024

Once "Installation" section is created, I will put the link in it

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

No branches or pull requests

2 participants