Skip to content

Getting a callgraph in standalone mode #983

Description

@iensen

Is there a way to obtain a callgraph in standalone mode?

I tried to run the following:

evgenii@pop-os:~/Software/ccls/Release$ ccls '--init={"cache":{"directory":"/home/evgenii/ccls_project/.ccls_cache","retainInMemory":0},"compilationDatabaseDirectory":"/home/evgenii/ccls_project/","index":{"initialNoLinkage":false,"threads":10,"trackDependency":0}}'
Content-Length: 225

{"jsonrpc":"2.0","method":"$ccls/call","params":{"textDocument":{"uri":"file:///home/evgenii/ccls_project/main.cpp"},"position":{"line":9,"character":8},"callee":false,"callType":3,"qualified":true,"hierarchy":true},"id":107}


But this returns an error:
{"jsonrpc":"2.0","id":107,"error":{"code":-32600,"message":"/home/evgenii/ccls_project/main.cpp is not opened"}}

I realized it's because the file is not opened, so I tried to add didOpen notification:

ccls '--init={"cache":{"directory":"/home/evgenii/ccls_project/.ccls_cache","retainInMemory":0},"compilationDatabaseDirectory":"/home/evgenii/ccls_project/","index":{"initialNoLinkage":false,"threads":10,"trackDependency":0}}'
Content-Length: 286

{"jsonrpc":"2.0","method":"textDocument/didOpen","params":{"textDocument": {"uri": "file:///home/evgenii/ccls_project/main.cpp", "languageId": "cpp", "version": 0, "text": "#include<stdio.h>\nint f2() {\n  return 0;\n}\nint f1() {\nreturn f2();\n}\n\nint main() {\n  return f1();\n}"}}}

However this just returns another error:

ccls: ./src/pipeline.cc:560: ccls::pipeline::launchStdin()::<lambda()>: Assertion !document->HasParseError()' failed.

`

I don't see anything wrong with my jsonrpc request. Any idea? Here is my main.cpp:

#include<stdio.h>

int f2() {
  return 0;
}

int f1() {
return f2();
}

int main() {
  return f1();
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions