xulion / scope4code

cscope support for visual studio code
MIT License
21 stars 8 forks source link

Unable to jump function after modifying code #61

Closed vernon2gh closed 3 years ago

vernon2gh commented 3 years ago
  1. scope4code version: v0.2.0
  2. PC system: ubuntu20.04

I generated cscope database, can normally jump function, and then modify the source code, save, can not jump function phenomenon, has been in a circle

xulion commented 3 years ago

can you share your settings? Especially the command line parameters if you changed them. The default parameter shall rebuild the database each time after you changed the code.

vernon2gh commented 3 years ago
        "scope4code.databasePath": "${workspaceRoot}/",
        "scope4code.engineCommands": {
            "config_index": {
                "cscope": {
                    "linux": 0
                }
            },
            "config": [
                {
                    "find_cmd": "find ${src_path} -type f -name *.c -o -type f -name *.h -o -type f -name *.cpp -o -type f -name *.cc -o -type f -name *.mm",
                    // "database_cmd": "cscope -b -q -k -f cscope.out",
                    "database_cmd": "make ARCH=x86 cscope",
                    "find_all_ref": "cscope -q -k -f cscope.out -L0 ${text}",
                    "find_define": "cscope -q -k -f cscope.out -L1 ${text}",
                    "find_callee": "cscope -q -k -f cscope.out -L2 ${text}",
                    "find_caller": "cscope -q -k -f cscope.out -L3 ${text}",
                    "find_text": "cscope -q -k -f cscope.out -L4 ${text}"
                }
            ]
        },
xulion commented 3 years ago

hmm, this is interesting. Can you try to put the absolute path of cscope.out in the command? I'm suspecting the command might run in a different folder where cscope.out does not exist. If an absolute path works then I would suggest to change command to: -f ${database_path}/cscope.out and configure database path in the setting.

vernon2gh commented 3 years ago

Sure enough, it is an absolute path problem. Modify it to -f ${database_path}/cscope.out and it will succeed. Thank you very much.