Skip to main content
Participant
February 9, 2024
Question

Trouble with Code Navigation for WireBox-Injected Objects in VS Code

  • February 9, 2024
  • 1 reply
  • 341 views

I’ve run into an issue in the Adobe ColdFusion Builder extension for Visual Studio Code. I’m developing a ColdBox application using VS Code as my IDE. I’ve encountered a problem where VS Code fails to navigate to function definitions or references for objects created with ColdBox’s WireBox getInstance() and inject methods. This functionality works fine for objects instantiated with the new operator, but not for those managed by WireBox(ColdBox's Dependency Injection Module).

 

Has anyone else encountered this issue? Are there any tools, extensions, or settings adjustments you would recommend to improve code navigation for WireBox-injected objects? 

Does VSCode extension has a manual mapping option like the old Eclipse-based CFBuilder used to ?

 

I’m currently using ColdFusion (2021), ColdBox (coldbox-7.2), and the latest Adobe ColdFusion Builder extension for VS Code. Any advice or suggestions would be greatly appreciated. Thank you in advance!

    This topic has been closed for replies.

    1 reply

    Charlie Arehart
    Community Expert
    Community Expert
    February 10, 2024

    While I can't speak to wirebox specifics, I'll say that the CFBuilder vscode extension does require several characteristics be configured for many of its more advanced features to work:

    • Had you defined a server (in the cf extension tab of cfb), even if it's pointing only to your own local machine's cf instance? 
    • Had you created a cf project there, within a vscode workspace (as it guides one through, in creating a cf project)?
    • Is the file you're opening and working with located within that project? 
    • Was that Cf project connected to such a cf server?
    • Does that cfb display of the cf server show successful connection via its rds views, as shown on the cf extension tab?
    • Is the cf admin rds feature enabled for that cf instance which is pointed to by that cfb server configuration? 

     

    While it can seem overwhelming, all that's needed for the code insight features in cfb to find cfc's, methods etc, in the way that those would be served via cf itself (leveraging things like cf mappings, custom tag paths, etc). That's a large part of what makes it an IDE vs just a code editor. 

     

    Finally, are you saying things worked for you in some other ode, or using some other vscode extension? Knowing that may provide clues as to why it may or may not work in your current setup. 

    /Charlie (troubleshooter, carehart. org)
    Participant
    February 12, 2024

    Thank you for the detailed response.

    I can confirm that:

    • I have defined a server in the CF extension tab, pointing to my local ColdFusion (2021) instance.
    • I created a CF project within a VS Code workspace, following the extension’s guide for setting up a CF project.
    • The files I'm working on are indeed located within this project.
    • This CF project is connected to the specified CF server.
    • The CF server shows a successful connection.

    Following these guidelines, I've noticed that the code insight features work perfectly for objects created with ColdFusion's 'new' operator or createObject() function. This indicates to me that the basic setup and connectivity are correctly configured, as the extension successfully navigates to function definitions and references in these cases.

    However, the challenge arises specifically with objects instantiated via ColdBox's getInstance() method from the WireBox dependency injection module.

    This discrepancy in code navigation capability between standard ColdFusion object creation methods and ColdBox's WireBox DI mechanism is at the core of my issue. It appears the extension might not fully recognize or interpret WireBox's runtime object instantiation processes for code navigation purposes.

    Given this context, are there any additional configurations, tools, or extensions you might recommend that could help improve code navigation for WireBox-injected objects? Perhaps there's a way to manually map or hint to the extension about these WireBox-managed components?

    Again, thank you for your assistance.