Coder Social home page Coder Social logo

Comments (8)

akosyakov avatar akosyakov commented on August 17, 2024

Hi @vincentLiuxiang, could you be more specific what does not follow the LSP?

from monaco-languageclient.

vincentLiuxiang avatar vincentLiuxiang commented on August 17, 2024

@akosyakov
You can look at the red square inside the pictures.
textDocument/didChange

In LSP, when the method is textDocument/didChange, the params must be DidChangeTextDocumentParams

interface DidChangeTextDocumentParams {
	/**
	 * The document that did change. The version number points
	 * to the version after all provided content changes have
	 * been applied.
	 */
	textDocument: VersionedTextDocumentIdentifier;

	/**
	 * The actual content changes. The content changes describe single state changes
	 * to the document. So if there are two content changes c1 and c2 for a document 
	 * in state S10 then c1 move the document to S11 and c2 to S12.
	 */
	contentChanges: TextDocumentContentChangeEvent[];
}

/**
 * An event describing a change to a text document. If range and rangeLength are omitted
 * the new text is considered to be the full content of the document.
 */
interface TextDocumentContentChangeEvent {
	/**
	 * The range of the document that changed.
	 */
	range?: Range;

	/**
	 * The length of the range that got replaced.
	 */
	rangeLength?: number;

	/**
	 * The new text of the range/document.
	 */
	text: string;
}

but monaco-languageclient send data to sever like this:

{
    "method": "textDocument/didChange",
    "params": {
         "contentChanges": [
                 {  "text": "{↵    "$schema": "http://json.schemastore.org/coffeelint",↵    "line_endings": "unix"↵}aaa"  }
         ]
     }
}

the difference is in contentChanges.

from monaco-languageclient.

akosyakov avatar akosyakov commented on August 17, 2024

It depends on a language server, the json server used in the example is not able to handle incremental changes, so the client always sends the whole document. A server can communicate it as a part of exchanging initialization capabilities. Look for TextDocumentSyncKind in the specification.

from monaco-languageclient.

vincentLiuxiang avatar vincentLiuxiang commented on August 17, 2024

monaco-languageclient

15

theia-ide

15

from monaco-languageclient.

vincentLiuxiang avatar vincentLiuxiang commented on August 17, 2024

so, if My server support handle incremental changes, I can get the same result like the theia-ide?

what's more could you give an example that is closer to the production environment? java, js and so on?

from monaco-languageclient.

vincentLiuxiang avatar vincentLiuxiang commented on August 17, 2024

@akosyakov I am very new in LSP, I have Look for TextDocumentSyncKind in the specification. Thank you very much!

from monaco-languageclient.

akosyakov avatar akosyakov commented on August 17, 2024

@vincentLiuxiang You are welcome, I am closing it.

from monaco-languageclient.

Louis-7 avatar Louis-7 commented on August 17, 2024

I know this issue has been closed but I saw the screen shot, there is a "Content-Length: 25x" at the beginning of the data return by web-socket which as same as my project which use the language server provide by monaco-languageclient. This "Content-Length" will cause an error at language server side. But I didn't see it in the example given by monaco-languageclient. I'm wondering why I have this "Content-Length" and will it crash the hole process?

from monaco-languageclient.

Related Issues (20)

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.