Giter VIP home page Giter VIP logo

vscode-lsif-extension's Introduction

Extension to run a language server from a Language Server Index Format file

The extension allows to browse the content of a LSIF dump stored either in a SQLite DB or in a file using LSIF line json format. To open a dump use the command Open LSIF Database.

The extension is currently not published to the market place due to its use of native node modules. You therefore need to run it out of source or generate your own platform dependent VSIX file using the vsce tool.

vscode-lsif-extension's People

Contributors

aarnott avatar chrismwendt avatar dbaeumer avatar dependabot[bot] avatar doxakis avatar i-ky avatar joaomoreno avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

vscode-lsif-extension's Issues

Document directly under projectRoot is not working

  1. Create lsif file with the following content:
{"id":0,"type":"vertex","label":"metaData","version":"0.3.1","projectRoot":"file:///d:/LSIF_test"}
{"id":1,"type":"vertex","label":"project","kind":"cpp"}
{"id":2,"type":"vertex","label":"document","uri":"file:///d:/LSIF_test/file.txt","languageId":"cpp"}
{"id":3,"type":"edge","label":"contains","outV":1,"inV":2}

(Note projectRoot is file:///d:/LSIF_test and document is a direct child: file:///d:/LSIF_test/file.txt)

  1. Open the lsif file.

Expected: file.txt is listed in Explorer.
Actual: Expander in Explorer is spinning for minutes before crashing.

  1. Modify the lsif file to change the document URI to include a subfolder, e.g. file:///d:/LSIF_test/x/file.txt (note /x/ added).
  2. Observe the lsif file now opens successfully and lists file.txt (under x node).

Loading a very large LSIF file causes an internal error

I tried to load a 678mb LSIF file into the language server but it causes an internal error.

[Error - 9:36:21 AM] "toString()" failed
Error: "toString()" failed
    at stringSlice (buffer.js:560:43)
    at Buffer.toString (buffer.js:633:10)
    at Object.fs.readFileSync (fs.js:601:41)
    at Object.fs.readFileSync (ELECTRON_ASAR.js:538:29)
    at LsifDatabase.load (/home/matt/.vscode/extensions/ms-vscode.lsif-0.1.0/server/out/lsifDatabase.js:41:34)
    at /home/matt/.vscode/extensions/ms-vscode.lsif-0.1.0/server/out/lsifServer.js:97:26
    at Generator.next (<anonymous>)
    at fulfilled (/home/matt/.vscode/extensions/ms-vscode.lsif-0.1.0/server/out/lsifServer.js:8:58)
    at <anonymous>

The file is for a single (very big) project with over 3000 modules, 400 000 lines of code. It seems the failure is at the point where it tries to read the file.

Hover text is not escaped

C++ template hover text will have characters < and > in the hover text.
e.g. vector<int> v which rendered in VS Code as vector v.

The hover text needs to be properly escaped or its content type set before it is returned.

Uppercase driver letter does not work

  1. Install 0.1.0 release and open jsonrpc.lsif.
  2. Observe Explorer listing files under the lsif node.
  3. Edit jsonrpc.lsif replacing file:///c with file:///C and open the file.

Expected: Files are still listed under the lsif node.
Actual: There is nothing listed under the lsif node.

Lazy results for declarations and definitions are not resolving

Consider the following LSIF file:

{"id":0,"type":"vertex","label":"metaData","version":"0.3.1","projectRoot":"file:///d:/current/LSIF"}
{"id":1,"type":"vertex","label":"project","kind":"cpp"}
{"id":2,"type":"vertex","label":"document","uri":"file:///d:/current/LSIF/repro/test.cpp","languageId":"cpp","contents":"aQBuAHQAIABhADsACgBpAG4AdAAgAGIAIAA9ACAAYQA7AAoAIAAgAA"}
{"id":3,"type":"vertex","label":"resultSet"}
{"id":5,"type":"vertex","label":"range","start":{"line":0,"character":4},"end":{"line":0,"character":5}}
{"id":6,"type":"vertex","label":"definitionResult"}
{"id":8,"type":"vertex","label":"resultSet"}
{"id":10,"type":"vertex","label":"range","start":{"line":1,"character":4},"end":{"line":1,"character":5}}
{"id":11,"type":"vertex","label":"definitionResult"}
{"id":13,"type":"vertex","label":"range","start":{"line":1,"character":8},"end":{"line":1,"character":9}}
{"id":"e0","type":"edge","label":"contains","outV":1,"inV":2}
{"id":"e1","type":"edge","label":"contains","outV":2,"inV":5}
{"id":"e2","type":"edge","label":"contains","outV":2,"inV":10}
{"id":"e3","type":"edge","label":"contains","outV":2,"inV":13}
{"id":"e5","type":"edge","label":"textDocument/definition","outV":3,"inV":6}
{"id":"e7","type":"edge","label":"refersTo","outV":5,"inV":3}
{"id":"e8","type":"edge","label":"item","outV":6,"inV":5}
{"id":"e12","type":"edge","label":"textDocument/definition","outV":8,"inV":11}
{"id":"e14","type":"edge","label":"refersTo","outV":10,"inV":8}
{"id":"e15","type":"edge","label":"item","outV":11,"inV":10}
{"id":"e17","type":"edge","label":"refersTo","outV":13,"inV":3}

corresponding to the following program:

int a;
int b = a;

Note that definitionResult vertices have result keys omitted, with the relationships instead provided by the item edges (id e8 and e15) as discussed in microsoft/lsif-node#3.

  1. Open LSIF file.
  2. Invoke Go to Definition on any of the identifiers.

Expected: Go to Definition resolves.
Actual: Go to Definition fails.

getting error while opening dump.lsif

getting error while opening dump.lsif file.
Steps:-
1- I created the 'dump.lsif' file for one of the typescript file .
2- After launching the client from the server 'vscode-lsif-extension', opened the LSIF database file(dump.lsif) from the extension host and got the error attached in the screenshot.
Please refer to the attached screenshot for more details
Screenshot 2021-03-26 at 2 16 30 PM

Still unable to load samples/jsonrpc.db file

Even after the fix for #24 I still can't open the sample database:

[Error - 14:36:06] Can't create database for lsif:/c%3A/Users/...

After I modified

} catch (_error) {
// report FileNotFound when accessing.
}

by adding this line to the catch block:

		connection.console.error(_error.message);

I got this:

[Error - 14:36:06] The module '\\?\c:\Users\XXX\Documents\GitHub\XXX\vscode-lsif-extension\server\node_modules\better-sqlite3\build\Release\better_sqlite3.node'
was compiled against a different Node.js version using
NODE_MODULE_VERSION 72. This version of Node.js requires
NODE_MODULE_VERSION 85. Please try re-compiling or re-installing
the module (for instance, using `npm rebuild` or `npm install`).

I am building and testing with this:

Version: 1.55.0-insider (user setup)
Commit: c185983a683d14c396952dd432459097bc7f757f
Date: 2021-03-30T12:48:52.547Z
Electron: 11.3.0
Chrome: 87.0.4280.141
Node.js: 12.18.3
V8: 8.7.220.31-electron.0
OS: Windows_NT x64 10.0.19042

Symlinks defeat the language server

If I symlink a file to the workspace then the language server refuses to read it. It only works if I copy the lsif.json file into the right place.

`Requires version 0.5.0 or higher but received: 0.5.3` when loading freshly-made lsif file

  1. npm install -g lsif
  2. Clone this repo and build with npm install
  3. Open the folder in VS Code.
  4. In Terminal run this command to build lsif of this repo: lsif tsc -p .\tsconfig.json samples/self.lsif
  5. Run with F5
  6. Run Open LSIF Database, navigate to this repo's samples folder and choose self.lsif
  7. View the LSIF Output Channel.
Debugger listening on ws://127.0.0.1:6029/d9ff94d1-7c1e-4018-97e1-d3d698768c54
For help, see: https://nodejs.org/en/docs/inspector
[Error - 14:54:21] Requires version 0.5.0 or higher but received: 0.5.3

Unable to load samples/jsonrpc.* files

Probably because the samples were created with an older LSIF version. I can see that jsonrpc.lsif was created with LSIF version 0.3.1

  • No project root provided message in Output when trying to load jsonrpc.lsif
  • Can't create database for lsif:/c%3A/XXX/samples/jsonrpc.db when trying to load jsonrpc.db

error TS2344: Type 'T' does not satisfy the constraint 'Object'.

Hi, I've got this error.
Any idea?

$ npm run compile

> [email protected] compile
> tsc -b

server/node_modules/lsif-protocol/lib/protocol.d.ts:897:65 - error TS2344: Type 'T' does not satisfy the constraint 'Object'.

897 export declare class EdgeDescriptor<T> extends ObjectDescriptor<T> {
                                                                    ~

  server/node_modules/lsif-protocol/lib/protocol.d.ts:897:37
    897 export declare class EdgeDescriptor<T> extends ObjectDescriptor<T> {
                                            ~
    This type parameter might need an `extends Object` constraint.

server/node_modules/lsif-protocol/lib/protocol.d.ts:900:48 - error TS2344: Type 'T' does not satisfy the constraint 'Object'.

900     constructor(description: ObjectDescription<T>, cardinality: Cardinality, edgeDescriptions: [VertexDescriptor<V>, VertexDescriptor<V>][]);
                                                   ~

  server/node_modules/lsif-protocol/lib/protocol.d.ts:897:37
    897 export declare class EdgeDescriptor<T> extends ObjectDescriptor<T> {
                                            ~
    This type parameter might need an `extends Object` constraint.


Found 2 errors.

node version is v20.5.0

Error not a directory, scandir '\vscode-lsif-extension\samples\jsonrpc.lsif'

When I clone this repository, press F5 and try to open the sample database (Via > Open LSIF database) I receive the following output.

(node:2712) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
(Use `Code --trace-deprecation ...` to show where the warning was created)
c:\Users\tdg\AppData\Local\Programs\Microsoft VS Code\resources\app\out\bootstrap-fork.js:5
(node:11152) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
(Use `Code --trace-deprecation ...` to show where the warning was created)
c:\Users\tdg\AppData\Local\Programs\Microsoft VS Code\resources\app\out\bootstrap-fork.js:5
rejected promise not handled within 1 second: Error: ENOTDIR: not a directory, scandir 'c:\Anta\vscode-lsif-extension\samples\jsonrpc.lsif'
c:\Users\tdg\AppData\Local\Programs\Microsoft VS Code\resources\app\out\bootstrap-fork.js:5
stack trace: Error: ENOTDIR: not a directory, scandir 'c:\Anta\vscode-lsif-extension\samples\jsonrpc.lsif'
c:\Users\tdg\AppData\Local\Programs\Microsoft VS Code\resources\app\out\bootstrap-fork.js:5

VS Code About:

Version: 1.62.3 (user setup)
Commit: ccbaa2d27e38e5afa3e5c21c1c7bef4657064247
Date: 2021-11-17T08:11:14.551Z
Electron: 13.5.2
Chrome: 91.0.4472.164
Node.js: 14.16.0
V8: 9.1.269.39-electron.0
OS: Windows_NT x64 10.0.22000

Make this vscode independent

Would it be possible to make this a vscode independent language server, so that any editor supporting LSP could take advantage of it?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.