SeungukShin / cscope-code

Cscope Extension for Code
11 stars 4 forks source link

Issues with opening a found result #9

Closed merrychap closed 2 years ago

merrychap commented 3 years ago

Hello and thank you for the nice VScode extension! :)

Unfortunately, I have some issues with opening a found result.

Let's say we are working with Linux kernel 5.1.9 source code tree and would like to find the definition of getname function from the do_sys_open function located at fs/open.c:1063. I press Ctrl+. a (because it's easier to find the function definition by looking up at the inner functions than using ctrl+. g which is another issue by the way) when the cursor is on getname and in the appeared files list window the correct location (fs/namei.c:208) is highlighted which is OK. But when I press Enter to jump to that location the window just closes and nothing happens. The expected behavior is jumping to the selected location from the appeared files list window

Surprisingly, it happens randomly depending on the chosen function.

Thank you in advance!

SeungukShin commented 3 years ago

Dear @merrychap ,

I'm sorry for late reply and inconvenience. I do the same thing with your description, I cannot face the symptoms you mentioned. It does not happen statically as you described. I'll review the extension code to find any possibilities to cause this symptoms. But, I got new project at work, I don't have enough time to invest this one, so it takes some time.

Thank you.

merrychap commented 3 years ago

@SeungukShin Thank you for your answer :)

Can I ask you which version of VScode you are using?

UPD: I'm currently using 1.58.2 version

UPD: If the searched function is located in the same file, then the jump to that location happens without a problem. Maybe the problem is related to the opening location in other file

SeungukShin commented 3 years ago

Dear @merrychap ,

My environment is v1.56.2 @ Linux.

merrychap commented 3 years ago

@SeungukShin My tests reveal that the root cause of this behavior is the following config parameter:

"workbench.editor.revealIfOpen": false

If this parameter is true, then everything is OK and a new window is opened, but in case the file is already opened and this parameter is enabled, then cscope-code will not open the desired file. Maybe we can do something with it?

SeungukShin commented 2 years ago

Dear @merrychap, Thank you for your analysis and patient. This is the problem with workbench.editor.revealIfOpen and cscope-code.[cscope-code-0.0.6.zip](https://github.com/SeungukShin/cscope-code/files/7612460/cscope-code-0.0.6.zip). cscope-code.preview use another editor group to preview the file which is selected in the result list. If you enter for that file, then cscope-code tries to close the preview editor and open that file in active editor group. The behavior of the previous version of vscode - it's like workbench.editor.revealIfOpen is enabled - is opening that file if it is not opened yet, or focusing the editor if that file is already opened. The changed behavior - it's like workbench.editor.revealIfOpen is disabled - is opening that file if it is not opened yet, or opening that file again in current active editor group - it might be preview editor group - instead of reveal the same file in the other editor group. I think we have 2 options here: enabling workbench.editor.revealIfOpen or disabling cscope-code.preview. Also I found cscope-code.preview does not work in the latest version, so I attached the fixed version here. cscope-code-0.0.6.zip