Post by cagatay117 » Sat Jan 28, 2023 3:28 am

I am looking for a way that I can see the definitions of methods, variable declarations etc. in Visual Studio Code. This can be with or without extension but I couldn't find how to do it.
For example, when I hover on "model" on this line: $this->load->model('localisation/currency');, a tooltip should popup and show the declaration. Or when I right click on "get" and select "Go to Definition" it should go to file which has this get() function. Now it says:
No definition found for 'get'
I tried some extensions like PHP Intelephense, PHP Intellisense but didn't work.
I am using Opencart v3.0.3.8 and latest version of VS Code.

Image

User avatar
Newbie

Posts

Joined
Mon Aug 15, 2022 11:06 pm

Post by purpletreesoft » Tue Jan 31, 2023 5:41 pm

you can use the following steps:
  • Install the Code Navigation extension: This extension provides Go to Definition, Peek Definition, and Find all References features for Visual Studio Code.
  • Right-click on the method or variable and select "Go to Definition": This will take you to the file where the definition of the method or variable is defined.
  • Use the "Peek Definition" option: This option allows you to view the definition of the method or variable without leaving the current file. Simply right-click on the method or variable and select "Peek Definition."
  • Use the "Find all References" option: This option allows you to view all references of the method or variable in your code. Simply right-click on the method or variable and select "Find all References."

Purpletree Software LLP
New features launched for Multivendor Marketplace Extension


User avatar
New member

Posts

Joined
Thu Jun 22, 2017 10:17 pm


Post by cagatay117 » Wed Feb 01, 2023 12:36 am

purpletreesoft wrote:
Tue Jan 31, 2023 5:41 pm
you can use the following steps:
  • Install the Code Navigation extension: This extension provides Go to Definition, Peek Definition, and Find all References features for Visual Studio Code.
  • Right-click on the method or variable and select "Go to Definition": This will take you to the file where the definition of the method or variable is defined.
  • Use the "Peek Definition" option: This option allows you to view the definition of the method or variable without leaving the current file. Simply right-click on the method or variable and select "Peek Definition."
  • Use the "Find all References" option: This option allows you to view all references of the method or variable in your code. Simply right-click on the method or variable and select "Find all References."
  • I installed Code Navigation extension. It provided navigation function but go to definition and peek definition didn't work. Find all references doesn't help me since it finds 10000 references (depending on the method I select)
  • Selecting "Go to Definition" doesn't work as I explained and showed on the screenshot.
  • Selecting "Peek Definition" doesn't work as I explained and showed on the screenshot.
  • Selecting "Find all References" doesn't help either, shows too much references and doesn't show the source where it was defined.
Did you have time to test the issue on a file with a call like these below and right-clicking on model, or editSetting, then selecting "Go to Definition"? (these are merely examples, OpenCart are full of these calls as you'd know.):

Code: Select all

$this->load->model('localisation/currency');
or

Code: Select all

$this->model_setting_setting->editSetting('config', $this->request->post);
Maybe I am looking at this situation from a wrong aspect and should do something else, I don't know.

User avatar
Newbie

Posts

Joined
Mon Aug 15, 2022 11:06 pm
Who is online

Users browsing this forum: No registered users and 31 guests