Merge pull request #7 from yeger00/add-did-change
adding did change method
This commit is contained in:
commit
423a8a1369
21
classes.dot
21
classes.dot
@ -58,15 +58,18 @@ rankdir=BT
|
|||||||
"54" [label="Struct", shape="record"];
|
"54" [label="Struct", shape="record"];
|
||||||
"55" [label="SymbolInformation", shape="record"];
|
"55" [label="SymbolInformation", shape="record"];
|
||||||
"56" [label="SymbolKind", shape="record"];
|
"56" [label="SymbolKind", shape="record"];
|
||||||
"57" [label="TextDocumentIdentifier", shape="record"];
|
"57" [label="TextDocumentContentChangeEvent", shape="record"];
|
||||||
"58" [label="TextDocumentItem", shape="record"];
|
"58" [label="TextDocumentIdentifier", shape="record"];
|
||||||
"59" [label="TextDocumentPositionParams", shape="record"];
|
"59" [label="TextDocumentItem", shape="record"];
|
||||||
"60" [label="TextEdit", shape="record"];
|
"60" [label="TextDocumentPositionParams", shape="record"];
|
||||||
"61" [label="TypeParameter", shape="record"];
|
"61" [label="TextEdit", shape="record"];
|
||||||
"62" [label="UnknownErrorCode", shape="record"];
|
"62" [label="TypeParameter", shape="record"];
|
||||||
"63" [label="Variable", shape="record"];
|
"63" [label="UnknownErrorCode", shape="record"];
|
||||||
"64" [label="serverErrorEnd", shape="record"];
|
"64" [label="Variable", shape="record"];
|
||||||
"65" [label="serverErrorStart", shape="record"];
|
"65" [label="VersionedTextDocumentIdentifier", shape="record"];
|
||||||
|
"66" [label="serverErrorEnd", shape="record"];
|
||||||
|
"67" [label="serverErrorStart", shape="record"];
|
||||||
|
"65" -> "58" [arrowhead="empty", arrowtail="none"];
|
||||||
"29" -> "55" [arrowhead="diamond", arrowtail="none", fontcolor="green", label="location", style="solid"];
|
"29" -> "55" [arrowhead="diamond", arrowtail="none", fontcolor="green", label="location", style="solid"];
|
||||||
"45" -> "47" [arrowhead="diamond", arrowtail="none", fontcolor="green", label="start", style="solid"];
|
"45" -> "47" [arrowhead="diamond", arrowtail="none", fontcolor="green", label="start", style="solid"];
|
||||||
"45" -> "47" [arrowhead="diamond", arrowtail="none", fontcolor="green", label="end", style="solid"];
|
"45" -> "47" [arrowhead="diamond", arrowtail="none", fontcolor="green", label="end", style="solid"];
|
||||||
|
@ -81,9 +81,22 @@ class LspClient(object):
|
|||||||
client needs to send a textDocument/didClose to the server followed by a textDocument/didOpen with the new language id if the server
|
client needs to send a textDocument/didClose to the server followed by a textDocument/didOpen with the new language id if the server
|
||||||
handles the new language id as well.
|
handles the new language id as well.
|
||||||
|
|
||||||
:param TextDocumentItem textDocument: The initial trace setting. If omitted trace is disabled ('off').
|
:param TextDocumentItem textDocument: The document that was opened.
|
||||||
"""
|
"""
|
||||||
return self.lsp_endpoint.send_notification("textDocument/didOpen", textDocument=textDocument)
|
return self.lsp_endpoint.send_notification("textDocument/didOpen", textDocument=textDocument)
|
||||||
|
|
||||||
|
|
||||||
|
def didChange(self, textDocument, contentChanges):
|
||||||
|
"""
|
||||||
|
The document change notification is sent from the client to the server to signal changes to a text document.
|
||||||
|
In 2.0 the shape of the params has changed to include proper version numbers and language ids.
|
||||||
|
|
||||||
|
:param VersionedTextDocumentIdentifier textDocument: The initial trace setting. If omitted trace is disabled ('off').
|
||||||
|
:param TextDocumentContentChangeEvent[] contentChanges: 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 S then c1 move the document
|
||||||
|
to S' and c2 to S''.
|
||||||
|
"""
|
||||||
|
return self.lsp_endpoint.send_notification("textDocument/didChange", textDocument=textDocument, contentChanges=contentChanges)
|
||||||
|
|
||||||
|
|
||||||
def documentSymbol(self, textDocument):
|
def documentSymbol(self, textDocument):
|
||||||
|
@ -160,6 +160,47 @@ class TextDocumentIdentifier(object):
|
|||||||
"""
|
"""
|
||||||
self.uri = uri
|
self.uri = uri
|
||||||
|
|
||||||
|
|
||||||
|
class VersionedTextDocumentIdentifier(TextDocumentIdentifier):
|
||||||
|
"""
|
||||||
|
An identifier to denote a specific version of a text document.
|
||||||
|
"""
|
||||||
|
def __init__(self, uri, version):
|
||||||
|
"""
|
||||||
|
Constructs a new TextDocumentIdentifier instance.
|
||||||
|
|
||||||
|
:param DocumentUri uri: The text document's URI.
|
||||||
|
:param int version: The version number of this document. If a versioned
|
||||||
|
text document identifier is sent from the server to the client and
|
||||||
|
the file is not open in the editor (the server has not received an
|
||||||
|
open notification before) the server can send `null` to indicate
|
||||||
|
that the version is known and the content on disk is the truth (as
|
||||||
|
speced with document content ownership).
|
||||||
|
The version number of a document will increase after each change, including
|
||||||
|
undo/redo. The number doesn't need to be consecutive.
|
||||||
|
"""
|
||||||
|
super(VersionedTextDocumentIdentifier, self).__init__(uri)
|
||||||
|
self.version = version
|
||||||
|
|
||||||
|
|
||||||
|
class TextDocumentContentChangeEvent(object):
|
||||||
|
"""
|
||||||
|
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.
|
||||||
|
"""
|
||||||
|
def __init__(self, range, rangeLength, text):
|
||||||
|
"""
|
||||||
|
Constructs a new TextDocumentContentChangeEvent instance.
|
||||||
|
|
||||||
|
:param Range range: The range of the document that changed.
|
||||||
|
:param int rangeLength: The length of the range that got replaced.
|
||||||
|
:param str text: The new text of the range/document.
|
||||||
|
"""
|
||||||
|
self.range = range
|
||||||
|
self.rangeLength = rangeLength
|
||||||
|
self.text = text
|
||||||
|
|
||||||
|
|
||||||
class TextDocumentPositionParams(object):
|
class TextDocumentPositionParams(object):
|
||||||
"""
|
"""
|
||||||
A parameter literal used in requests to pass a text document and a position inside that document.
|
A parameter literal used in requests to pass a text document and a position inside that document.
|
||||||
|
Loading…
Reference in New Issue
Block a user