sourcepawn-vscode icon indicating copy to clipboard operation
sourcepawn-vscode copied to clipboard

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

Open stas11s11t opened this issue 1 year ago • 3 comments

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.

stas11s11t avatar Nov 24 '23 23:11 stas11s11t

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

Alienmario avatar Nov 28 '23 00:11 Alienmario

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?

stas11s11t avatar Dec 01 '23 04:12 stas11s11t

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 avatar Dec 03 '23 09:12 Sarrus1

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

Sarrus1 avatar May 15 '24 07:05 Sarrus1

@Sarrus1 No more goto-declaration issues for me!

Well, there some special cases.

  • Goto Handle goes to using __intrinsics__.Handle rather than the enum Handle.
  • Does not work for functions/definitions inside macros
#define TICK_INTERVAL	(GetTickInterval())
#define TICKS_TO_TIME(%1)  ( TICK_INTERVAL *(%1) )
  • Nor inside #if defined blocks it thinks are disabled.
  • Actually managed to find a code block writing this, that breaks goto's after it
#if defined something

/**
 *  It hates this
 */

#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 <sourcemod>

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<Address>(oper2);
}

Alienmario avatar May 15 '24 15:05 Alienmario

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

Sarrus1 avatar May 16 '24 07:05 Sarrus1

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.

Sarrus1 avatar May 17 '24 07:05 Sarrus1

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.

Alienmario avatar May 17 '24 16:05 Alienmario

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 :)

Sarrus1 avatar May 18 '24 06:05 Sarrus1