-
Notifications
You must be signed in to change notification settings - Fork 8
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
Usages/definitions don't work across included files on Windows #22
Comments
I need quite a bit more information in order to reproduce this issue. What operating systems are these 2 computers? Are the other files included using “#include” statements? Do you get any output in VSCode’s Output tab? |
Yea sorry I figured you'd need more information but I wasn't sure what. The one where the problems do show up is Windows 10, the one where they don't is Ubuntu MATE 22.04. Output on both has There is one .p8 file with #include statements, no other files have them as Pico-8 doesn't support that. On the linux machine, trying to call a function that doesn't exist doesn't give any warnings or anything. So it seems like its working as intended on windows? Though it would be nice to have an option for it to not need includes, and recognize things across files regardless, so that files can be used more like pico-8 tabs. Both are VSCode 1.70.0 |
In my testing, Can you provide a minimal reproducible example? e.g. like 2 small files that have nothing else in them except what is necessary to reproduce the problem. Screencasts are good too.
That wouldn't work with pico-8 though, since different tabs in pico-8 all go into the same .p8 file. We already support working with multiple files in a way that is supported by pico-8, which is the |
I tried what you said and made a small example. I deleted the #include statement, and on the Windows computer it said foo was an undefined variable. On the Linux machine it did not could still recognize it. Strangely I came back an hour later and it worked properly on Linux. But only in this example. Not in my actual project. |
Thing is that #include statements can only go in the main .p8 file. And because of the limitations of editing that file while also having Pico-8 open, it can be desirable to have it be just some import statements and all code in other files. This means I can use each file similar to a tab in Pico-8, but I get warnings because of things not being included in each file. |
Wouldn't you have to edit the file every time to get it to work in PICO-8, though? Like, PICO-8 isn't going to just recognize variables in other files just because you want it to. Plus, there's a big downside to having this language extension just automatically treat everything in the folder as if it's the same project, and that is naming clashes. If you have multiple .p8 files open and they both have common things like |
What do you mean "it works just fine"? What do you want to toggle? |
Btw, I ran your example on Linux and I get a warning So anyways, unless you'll be able to provide more help in reproducing this problem, I won't be able to look into it. However, I'm happy to answer questions and offer guidance if you want to try cloning this repo and debugging the issue yourself. |
The p8 file is just these includes. The code in it is not being edited unless I add a new file. I started with tabs and made each tab into it's own file for ease of editing and organization in vscode. I thought you were implying that somehow that would not work. But it does work totally fine.
I'm suggesting that recognizing the files in the folder as part of the same project is something that could perhaps be toggled. |
Yea this example started working for me a while after making it.
I can make my repo public so that you can see what happens if you clone it and try opening it in vscode. I get it if you don't want to. |
It should already be supported. When you have a p8 file that includes those other lua files, it should recognize it as all one big project. Sure, if you want to make your repo public, I can try opening it and seeing what happens. You'll have to give more specific instructions on which lines in which files you comment out, and where you expect to see the warnings but don't. |
Here is the repo: As it currently is, there are zero warnings on my Linux computer. I can get rid of that warning on Windows with #include game_loop.lua in ball.lua. But of course that doesn't work in Pico-8 as it doesn't support includes in other files. |
It looks like if I delete all the #includes in breakout.p8 on linux, I get the same warnings I get on Windows with the #includes. |
Gotcha. Sounds like the real problem is that the |
Ah okay, as I originally said, I wasn't sure which was intended. I made some assumptions about how includes worked and figured it was more likely the problem was on linux. There is stlll the lack of warnings for things that really are undefined on Linux Oops didn't mean to close |
Can you provide an example of this happening? In my testing, undefined symbols get warnings. |
Just released 0.4.7 with a fix for this. If there's another problem where undefined things on Linux are not getting warnings properly, open a separate issue for that. |
I'll try 0.4.7 and see if I still have any more problems. |
No issues on Windows for me now. Works great. And all my previous comments about adding a feature can be disregarded because they were based on an assumption that windows was working as intended. |
I am having different behavior on two different computers with no changes made to settings. I don't know which is the intended behavior. On one, every one of my files is saying it has undefined functions (because they were defined in other files). On my other computer, there is not a single warning, and it recognizes them as the same functions and variables across files.
The text was updated successfully, but these errors were encountered: