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

Go To Definition target file is incorrect #444

Open
F1F88 opened this issue Jan 21, 2025 · 0 comments
Open

Go To Definition target file is incorrect #444

F1F88 opened this issue Jan 21, 2025 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@F1F88
Copy link

F1F88 commented Jan 21, 2025

Basic informations

  • OS: [Windows]
  • VSCode version: Latest
  • Extension version: Latest

Further Information

In "include/log4sp.inc", when the LOG4SP_NO_EXT macro is not defined, header files in "include/log4sp" folder will be included.

Conversely, if the LOG4SP_NO_EXT macro is defined, header files in "include/log4sp_no_ext" folder will be included.

Therefore, it should be possible to include or jump to header files different folders depending on whether the macro LOG4SP_NO_EXT is defined.

But the actual situation is that regardless of whether the LOG4SP_NO_EXT macro is defined, Go To Logger will jump to "include/log4sp_no_ext/logger.inc"

Even without include "include/log4sp/common.inc" and "include/log4sp_no_ext/common.inc", but after deleting these two files, the error will disappear.

To Reproduce

  • test_log4sp.sp

    #include <log4sp>
    
    public void OnPluginStart()
    {
        // Go to Logger jumps to "include/log4sp_no_ext/logger.inc"
        // Not "include/log4sp/logger.inc"
        Logger log = new Logger("name");
    
        // Error: no method `GetLevel` on type `Logger`
        // But it compiles fine.
        log.GetLevel();
    }
  • include

    • log4sp.inc

      #if defined _log_for_sourcepawn_included
      #endinput
      #endif
      #define _log_for_sourcepawn_included
      
      #if !defined LOG4SP_NO_EXT
      
      #include <log4sp/logger>
      
      #else
      
      #include <log4sp_no_ext/logger>
      
      #endif
    • log4sp

      • common.inc

        #if defined _log_for_sourcepawn_common_included
        #endinput
        #endif
        #define _log_for_sourcepawn_common_included
      • logger.inc

        #if defined _log_for_sourcepawn_logger_included
        #endinput
        #endif
        #define _log_for_sourcepawn_logger_included
        
        methodmap Logger < Handle
        {
            public native Logger(const char[] name);
        
            public native int GetLevel();
        }
    • log4sp_no_ext

      • common.inc

        #if defined _log_for_sourcepawn_common_included
        #endinput
        #endif
        #define _log_for_sourcepawn_common_included
      • logger.inc

        #if defined _log_for_sourcepawn_logger_included
        #endinput
        #endif
        #define _log_for_sourcepawn_logger_included
        
        methodmap Logger < Handle
        {
            public Logger(const char[] name) {
                return view_as<Logger>(INVALID_HANDLE);
            }
        
            // public int GetLevel() {
            //     return 2;
            // }
        }

Code to reproduce the behaviour

Go To Definition incorrect

Image

No method GetLevel on type Logger

Image

Expected behaviour

If LOG4SP_NO_EXT is not defined, should jump to the include files of "include/log4sp/**".

@F1F88 F1F88 added the bug Something isn't working label Jan 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants