Giter Site home page Giter Site logo

axelson / language-server-protocol-inspector Goto Github PK

View Code? Open in Web Editor NEW

This project forked from microsoft/language-server-protocol-inspector

0.0 3.0 0.0 875 KB

Interactive Language Server log inspector

Home Page: https://microsoft.github.io/language-server-protocol/inspector/

License: MIT License

TypeScript 31.94% JavaScript 12.19% HTML 0.83% Vue 51.15% CSS 3.89%

language-server-protocol-inspector's Introduction

Language Server Protocol Inspector

Try it at https://microsoft.github.io/language-server-protocol/inspector/.

Motivation

When you are using vscode-languageserver-node to develop a language server, it's possible to specify a setting "[langId].trace.server": "verbose" to make the Language Client log the LSP communication. This log is useful for developing and testing the Language Server, but the log can be lengthy โ€” using the editor for 5 seconds could generate 5000 lines of LSP log. This makes it hard to gain insight from the logs.

This inspector visualizes the logs to make it easy to understand the communication between the Language Client / Server. It also lets you filter the logs by search query or language features, so you can quickly identify the logs you are interested in.

lsp-inspector

Usage

  • A log file (log from html Language Server) is loaded by default.
  • Click each LSP item to expand its parameters.
  • Type a query into the search bar to filter the logs.
  • Select a language feature area to filter the logs.
  • Collect your own logs and inspect them! For example:
    • Set css.trace.server: "verbose" in VS Code.
    • Open a CSS file.
    • Copy everything inside CSS Language Server channel into a log file css.log.
    • Load it from the web app.
  • You can try it on real-world logs file at /tests/unit/logParser/fixture.

Log Format

The Inspector takes two log formats: text and json.

  • text:
    • Logs generated by setting "[langId].trace.server": "verbose".
    • Logs generated by setting "[langId].trace.server": { "format": "Text" }
  • json: Logs generated by setting: "[langId].trace.server": { "format": "JSON" }

The Inspector could load any JSON logs, as long as they follow this format:

export type MsgKind =
  | 'send-notification'
  | 'recv-notification'
  | 'send-request'
  | 'recv-request'
  | 'send-response'
  | 'recv-response'

export interface LspItem {
  type: MsgKind
  message: any
  timestamp: unix timestamp
}

Each line is terminated with \r\n.

Here is a sample:

{"type":"receive-response","message":{"jsonrpc":"2.0","id":0,"result":{"capabilities":{"textDocumentSync":1,"completionProvider":{"resolveProvider":true}}}},"timestamp":1534721620392}\r\n
{"type":"send-notification","message":{"jsonrpc":"2.0","method":"initialized","params":{}},"timestamp":1534721620393}\r\n

Running & Developing

Navigate to the sub-folder lsp-inspector, and:

  • yarn
  • yarn serve

License

Copyright (c) Microsoft Corporation. All rights reserved.

Licensed under the MIT License.

language-server-protocol-inspector's People

Contributors

octref avatar microsoftopensource avatar eashi avatar jonnyboyc avatar msftgits avatar omartawfik avatar

Watchers

Jason Axelson avatar James Cloos avatar  avatar

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.