Sarrus1 / sourcepawn-studio

VSCode extension for SourcePawn scripting
https://sarrus1.github.io/sourcepawn-studio/
MIT License
140 stars 22 forks source link

"Go to definition" and hints stop working in .inc file. #353

Closed stas11s11t closed 3 months ago

stas11s11t commented 9 months ago

This happens quite often. To fix this I have to rename .inc file and restart vs code, but I still haven't figured out the exact sequence of steps I need to do to fix this. Very annoying. This seems to be related to ctrl+shift+f, when I want to rename the name of a function in several files. In any case, thanks for the extension, it is very good, but this flaw does not give me peace.

Alienmario commented 9 months ago

This happens quite often to me too. Restarting sourcepawn-lsp helps for a short while.

stas11s11t commented 8 months ago

This happens quite often to me too. Restarting sourcepawn-lsp helps for a short while.

Restart sourcepawn-lsp does not help me, maybe you are doing something additional?

Sarrus1 commented 8 months ago

Thanks for reporting this I am actively developing this branch, which hopefully will fix the issue: https://github.com/Sarrus1/sourcepawn-vscode/tree/feat/salsa

Sarrus1 commented 3 months ago

Hello, can anybody experimenting this issue can try the pre-release version to see if it still happens? Thanks!

Alienmario commented 3 months ago

@Sarrus1 No more goto-declaration issues for me!

Well, there some special cases.

/**

endif

- Does not support going to enum struct members with :: syntax

enum struct CServerConsoleCommand { ConVar m_pConvar; char m_szValue[256]; }

public void OnPluginStart() { int index = CServerConsoleCommand::m_pConvar; }

---

I'll list some of my  unrelated findings of v7 below:
- Some settings are not migrating correctly - iirc "SourcePawnLanguageServer.compiler.path" and "SourcePawnLanguageServer.includeDirectories" (perhaps extra s in includes)
- I'm so used to having function docs popup, I find myself pressing a kb shortcut to 'Trigger Parameter Hints' which now does something unrelated since they are not available :(
- Pressing 'Show Definition Preview Hover' shortcut while having cursor at the last letter of a function name does nothing.
- Go to references is not yet finding any for me.
- Getting 'Request textDocument/semanticTokens/full failed.' on unsaved SP files.
- Getting 'Request textDocument/definition failed.' when ctrl-hovering over myinfo elements. (this seems to be more widespread)

include

public Plugin myinfo = { name = "test", author = "test", description = "test", version = "test", url = "test" };

- It does have an issue with custom operator functions (though this is not used often)

stock Address operator+(Address oper1, int oper2) { return oper1 + view_as

(oper2); }

Sarrus1 commented 3 months ago

Hey @Alienmario thank you for the feedback, this is very valuable, I will try to fix those bugs asap! Will report back here 👍

Sarrus1 commented 3 months ago

Moved everything into a PR for clarity.

Not that Nor inside #if defined blocks it thinks are disabled. will probably never fully work. When a preprocessor block is disabled, the extension does not even look inside it. There might be some features working, for example, if you define a global (enum, methodmap, etc) outside of the disabled block and then GoToDef on a reference from inside the disabled block.

But this will not be a priority for the stable release.

Alienmario commented 3 months ago

Not that Nor inside #if defined blocks it thinks are disabled. will probably never fully work.

That's fine. I guess my long term wish is more related to how preprocessor blocks are evaluated.

1) We can pass defines through compiler arguments, and even switch through compile environments with "sourcepawn.availableAPIs" with different arguments in each - that's very good. However I couldn't find a way to make it recognize that and enable the required code paths in editor.

2) Some stocks are written in a way that depend on other includes being included beforehand. I use this in my stock libraries, but could only find one instance in SMLib. I suppose you can only control this if you know the main file. But as of right now, whether a particular block is enabled in editor is indeterminate.

Sarrus1 commented 3 months ago

Some issues have been fixed and some have been triaged to other issues as I am trying to focus on roadblock issue for the upcoming stable release 👍

All the details are in #391

In the meantime, v7.2.8 includes all the latest fixes if you want to give it a go :)