p42ai / js-assistant

120+ refactorings and code-assists for Visual Studio Code
https://marketplace.visualstudio.com/items?itemName=p42ai.refactor
MIT License
119 stars 7 forks source link

Extension doesn't show any hints #14

Closed pru-brennaveen closed 2 years ago

pru-brennaveen commented 2 years ago

Suggestions don't appear to be working in my vscode for some reason. I've put in some code that I know should trigger a refactor suggestion, but no suggestions appear on the code or the suggestions sidebar. I tried uninstalling and reinstalled and all of the suggestions settings are set to hint.

Does anyone have any suggestions on how I can fix this?

P42 v1.86.0

VScode Version: 1.64.2 (user setup) Commit: f80445acd5a3dadef24aa209168452a3d97cc326 Date: 2022-02-09T22:02:28.252Z Electron: 13.5.2 Chromium: 91.0.4472.164 Node.js: 14.16.0 V8: 9.1.269.39-electron.0 OS: Windows_NT x64 10.0.22000

lgrammel commented 2 years ago

Thanks for the bug report!

Can you try the following example?

let a = "123";
f(a);

It should show up as follows: image

The 3 dots under let are the suggestion indicator. Does it show for you?

Btw, in v1.86.0 the default suggestion level was changed from info (blue squiggly underline) to hint (3 dots) to make the suggestions look less distractive and indicate that they are not problems (many users perceived the squiggly line as such). You can set individual suggestions to different levels in the Visual Studio Code settings.

pru-brennaveen commented 2 years ago

No joy :(

image

The red squiggle on f is just eslint complaining that f is not defined.

lgrammel commented 2 years ago

Do you have a p42.toml in the root folder of your workspace? If so, please check if the refactoring is deactivated there (see https://p42.ai/documentation/p42-for-vscode/configuration#configuration-file for details, specific paths and/or refactorings could be disabled).

If not, can you set "p42.logging.error.enabled": true in your VS Code settings, restart VS Code, open the file that should show suggestions, and then check if any errors are logged in the 'Output' panel (select P42)?

pru-brennaveen commented 2 years ago

I don't have a p42.toml file so no worries there.

I added the setting (although vscode greys it out saying "Unknown Configuration Setting") and restarted vscode. There was nothing logged to the output panel.

The extension appears to be working because vscode shows that it had a 153ms activation time.

lgrammel commented 2 years ago

Thanks for checking! The "unknown configuration setting" is expected (the options are not exposed in the UI).

Just to make sure I'm not missing anything, what is the extension of the JavaScript file that you are working on?

P42 only works with certain extensions such as .js, .ts or .mjs (see https://p42.ai/documentation/p42-for-vscode/faq for all extensions).

pru-brennaveen commented 2 years ago

It is a .js file, but I think I've narrowed down the problem. It appears that the issue is related to multiple folders in the workspace. I created a test.js file with your code and saved it to a folder called p42-tests then ran the following tests:

Test 1

  1. Open folder with vscode
  2. P42 suggestions visible
  3. Save workspace
  4. Close and re-open workspace
  5. Suggestions still visible

Test 2

  1. Open folder with vscode
  2. P42 suggestions visible
  3. Add another folder to workspace
  4. Suggestions disappear
  5. Save workspace
  6. Close and reopen workspace
  7. Suggestions still not visible
lgrammel commented 2 years ago

Thanks for the investigation! I'll take a look at the multiple folders issue today and see if I can confirm & fix it.

lgrammel commented 2 years ago

Update: I have reproduced the issue, now working on a fix.

lgrammel commented 2 years ago

@pru-brennaveen I have just released version 1.86.1, which adds support for multiple workspace folders. Please re-open this issue if you still encounter the bug in 1.86.1 or higher. Thanks again for the bug report!

pru-brennaveen commented 2 years ago

Works! You are awesome, thanks for the super quick response and a great addon!

lgrammel commented 2 years ago

Thanks! I hope you find the extension helpful!