Skip to content

API Reference

CallHierarchyIncomingCall

Bases: BaseModel

Represents an incoming call, as part of the call hierarchy.

Parameters:

Name Type Description Default
from_ CallHierarchyItem

The item that makes the call.

required
fromRanges List[Range]

The ranges at which the calls appear.

required
Source code in tarts\structs.py
725
726
727
728
729
730
731
732
733
734
735
736
737
738
class CallHierarchyIncomingCall(BaseModel):
    """Represents an incoming call, as part of the call hierarchy.

    Args:
        from_ (CallHierarchyItem): The item that makes the call.
        fromRanges (List[Range]): The ranges at which the calls appear.
    """

    from_: CallHierarchyItem
    fromRanges: t.List[Range]

    class Config:
        # 'from' is an invalid field - re-mapping
        fields = {"from_": "from"}

CallHierarchyItem

Bases: BaseModel

Represents an item of a call hierarchy.

Parameters:

Name Type Description Default
name str

The name of this item.

required
kind SymbolKind

The kind of this item.

required
tags Optional[SymbolTag]

Tags for this item.

required
detail Optional[str]

More detail for this item.

required
uri str

The resource identifier of this item.

required
range Range

The range enclosing this symbol.

required
selectionRange Range

The range that should be selected and revealed when this symbol is being picked.

required
data Optional[Any]

A data entry field that is preserved between a call hierarchy prepare and incoming calls or outgoing calls requests.

required
Source code in tarts\structs.py
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
class CallHierarchyItem(BaseModel):
    """Represents an item of a call hierarchy.

    Args:
        name (str): The name of this item.
        kind (SymbolKind): The kind of this item.
        tags (Optional[SymbolTag]): Tags for this item.
        detail (Optional[str]): More detail for this item.
        uri (str): The resource identifier of this item.
        range (Range): The range enclosing this symbol.
        selectionRange (Range): The range that should be selected and revealed when this symbol is being picked.
        data (Optional[Any]): A data entry field that is preserved between a call hierarchy prepare and incoming calls or outgoing calls requests.
    """

    name: str
    kind: SymbolKind
    tags: t.Optional[SymbolTag]
    detail: t.Optional[str]
    uri: str
    range: Range
    selectionRange: Range
    data: t.Optional[t.Any]

CallHierarchyOutgoingCall

Bases: BaseModel

Represents an outgoing call, as part of the call hierarchy.

Parameters:

Name Type Description Default
to CallHierarchyItem

The item that is called.

required
fromRanges List[Range]

The ranges at which this item is called.

required
Source code in tarts\structs.py
741
742
743
744
745
746
747
748
749
750
class CallHierarchyOutgoingCall(BaseModel):
    """Represents an outgoing call, as part of the call hierarchy.

    Args:
        to (CallHierarchyItem): The item that is called.
        fromRanges (List[Range]): The ranges at which this item is called.
    """

    to: CallHierarchyItem
    fromRanges: t.List[Range]

CodeDescription

Bases: BaseModel

Represents a code description.

Parameters:

Name Type Description Default
href str

The URI to the code description.

required
Source code in tarts\structs.py
543
544
545
546
547
548
549
550
class CodeDescription(BaseModel):
    """Represents a code description.

    Args:
        href (str): The URI to the code description.
    """

    href: str

Command

Bases: BaseModel

Represents a reference to a command.

Parameters:

Name Type Description Default
title str

Title of the command, like save.

required
command str

The identifier of the actual command handler.

required
arguments Optional[List[Any]]

Arguments that the command handler should be invoked with.

required
Source code in tarts\structs.py
351
352
353
354
355
356
357
358
359
360
361
362
class Command(BaseModel):
    """Represents a reference to a command.

    Args:
        title (str): Title of the command, like `save`.
        command (str): The identifier of the actual command handler.
        arguments (Optional[List[Any]]): Arguments that the command handler should be invoked with.
    """

    title: str
    command: str
    arguments: t.Optional[t.List[t.Any]]

CompletionContext

Bases: BaseModel

Contains additional information about the context in which a completion request is triggered.

Parameters:

Name Type Description Default
triggerKind CompletionTriggerKind

How the completion was triggered.

required
triggerCharacter Optional[str]

The trigger character that caused the completion.

required
Source code in tarts\structs.py
289
290
291
292
293
294
295
296
297
298
class CompletionContext(BaseModel):
    """Contains additional information about the context in which a completion request is triggered.

    Args:
        triggerKind (CompletionTriggerKind): How the completion was triggered.
        triggerCharacter (Optional[str]): The trigger character that caused the completion.
    """

    triggerKind: CompletionTriggerKind
    triggerCharacter: t.Optional[str]

CompletionItem

Bases: BaseModel

A completion item represents a text snippet that is proposed to complete text that is being typed.

Parameters:

Name Type Description Default
label str

The label of this completion item.

required
kind Optional[CompletionItemKind]

The kind of this completion item.

required
tags Optional[CompletionItemTag]

Tags for this completion item.

required
detail Optional[str]

A human-readable string with additional information about this item.

required
documentation Union[str, MarkupContent, None]

A human-readable string that represents a doc-comment.

required
deprecated Optional[bool]

Indicates if this item is deprecated.

required
preselect Optional[bool]

Select this item when showing.

required
sortText Optional[str]

A string that should be used when comparing this item with other items.

required
filterText Optional[str]

A string that should be used when filtering a set of completion items.

required
insertText Optional[str]

A string that should be inserted into a document when selecting this completion.

required
insertTextFormat Optional[InsertTextFormat]

The format of the insert text.

required
textEdit Optional[TextEdit]

An edit which is applied to a document when selecting this completion.

required
additionalTextEdits Optional[List[TextEdit]]

An optional array of additional text edits that are applied when selecting this completion.

required
commitCharacters Optional[List[str]]

An optional set of characters that when pressed while this completion is active will accept it first and then type that character.

required
command Optional[Command]

An optional command that is executed after inserting this completion.

required
data Optional[Any]

A data entry field that is preserved on a completion item between a completion and a completion resolve request.

required
Source code in tarts\structs.py
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
class CompletionItem(BaseModel):
    """A completion item represents a text snippet that is proposed to complete text that is being typed.

    Args:
        label (str): The label of this completion item.
        kind (Optional[CompletionItemKind]): The kind of this completion item.
        tags (Optional[CompletionItemTag]): Tags for this completion item.
        detail (Optional[str]): A human-readable string with additional information about this item.
        documentation (Union[str, MarkupContent, None]): A human-readable string that represents a doc-comment.
        deprecated (Optional[bool]): Indicates if this item is deprecated.
        preselect (Optional[bool]): Select this item when showing.
        sortText (Optional[str]): A string that should be used when comparing this item with other items.
        filterText (Optional[str]): A string that should be used when filtering a set of completion items.
        insertText (Optional[str]): A string that should be inserted into a document when selecting this completion.
        insertTextFormat (Optional[InsertTextFormat]): The format of the insert text.
        textEdit (Optional[TextEdit]): An edit which is applied to a document when selecting this completion.
        additionalTextEdits (Optional[List[TextEdit]]): An optional array of additional text edits that are applied when selecting this completion.
        commitCharacters (Optional[List[str]]): An optional set of characters that when pressed while this completion is active will accept it first and then type that character.
        command (Optional[Command]): An optional command that is executed after inserting this completion.
        data (Optional[Any]): A data entry field that is preserved on a completion item between a completion and a completion resolve request.
    """

    label: str
    kind: t.Optional[CompletionItemKind]
    tags: t.Optional[CompletionItemTag]
    detail: t.Optional[str]
    documentation: t.Union[str, MarkupContent, None]
    deprecated: t.Optional[bool]
    preselect: t.Optional[bool]
    sortText: t.Optional[str]
    filterText: t.Optional[str]
    insertText: t.Optional[str]
    insertTextFormat: t.Optional[InsertTextFormat]
    textEdit: t.Optional[TextEdit]
    additionalTextEdits: t.Optional[t.List[TextEdit]]
    commitCharacters: t.Optional[t.List[str]]
    command: t.Optional[Command]
    data: t.Optional[t.Any]

CompletionItemKind

Bases: IntEnum

The kind of a completion entry.

Source code in tarts\structs.py
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
class CompletionItemKind(enum.IntEnum):
    """The kind of a completion entry.

    Attributes:
        Various completion item kinds with integer values from 1 to 25.
    """

    TEXT = 1
    METHOD = 2
    FUNCTION = 3
    CONSTRUCTOR = 4
    FIELD = 5
    VARIABLE = 6
    CLASS = 7
    INTERFACE = 8
    MODULE = 9
    PROPERTY = 10
    UNIT = 11
    VALUE = 12
    ENUM = 13
    KEYWORD = 14
    SNIPPET = 15
    COLOR = 16
    FILE = 17
    REFERENCE = 18
    FOLDER = 19
    ENUMMEMBER = 20
    CONSTANT = 21
    STRUCT = 22
    EVENT = 23
    OPERATOR = 24
    TYPEPARAMETER = 25

CompletionItemTag

Bases: IntEnum

Completion item tags are extra annotations that tweak the rendering of a completion item.

Attributes:

Name Type Description
DEPRECATED

Renders a completion as obsolete, usually using a strike-out.

Source code in tarts\structs.py
411
412
413
414
415
416
417
418
class CompletionItemTag(enum.IntEnum):
    """Completion item tags are extra annotations that tweak the rendering of a completion item.

    Attributes:
        DEPRECATED: Renders a completion as obsolete, usually using a strike-out.
    """

    DEPRECATED = 1

CompletionList

Bases: BaseModel

Represents a collection of completion items to be presented in the editor.

Parameters:

Name Type Description Default
isIncomplete bool

This list is not complete. Further typing should result in recomputing this list.

required
items List[CompletionItem]

The completion items.

required
Source code in tarts\structs.py
461
462
463
464
465
466
467
468
469
470
class CompletionList(BaseModel):
    """Represents a collection of completion items to be presented in the editor.

    Args:
        isIncomplete (bool): This list is not complete. Further typing should result in recomputing this list.
        items (List[CompletionItem]): The completion items.
    """

    isIncomplete: bool
    items: t.List[CompletionItem]

CompletionTriggerKind

Bases: IntEnum

Defines how the completion was triggered.

Attributes:

Name Type Description
INVOKED

Completion was triggered by typing an identifier.

TRIGGER_CHARACTER

Completion was triggered by a trigger character.

TRIGGER_FOR_INCOMPLETE_COMPLETIONS

Completion was re-triggered as the current completion list is incomplete.

Source code in tarts\structs.py
275
276
277
278
279
280
281
282
283
284
285
286
class CompletionTriggerKind(enum.IntEnum):
    """Defines how the completion was triggered.

    Attributes:
        INVOKED: Completion was triggered by typing an identifier.
        TRIGGER_CHARACTER: Completion was triggered by a trigger character.
        TRIGGER_FOR_INCOMPLETE_COMPLETIONS: Completion was re-triggered as the current completion list is incomplete.
    """

    INVOKED = 1
    TRIGGER_CHARACTER = 2
    TRIGGER_FOR_INCOMPLETE_COMPLETIONS = 3

ConfigurationItem

Bases: BaseModel

Represents a configuration item.

Parameters:

Name Type Description Default
scopeUri Optional[str]

The scope URI for this configuration item.

required
section Optional[str]

The section of the configuration this item belongs to.

required
Source code in tarts\structs.py
 996
 997
 998
 999
1000
1001
1002
1003
1004
1005
class ConfigurationItem(BaseModel):
    """Represents a configuration item.

    Args:
        scopeUri (Optional[str]): The scope URI for this configuration item.
        section (Optional[str]): The section of the configuration this item belongs to.
    """

    scopeUri: t.Optional[str]
    section: t.Optional[str]

Diagnostic

Bases: BaseModel

Represents a diagnostic, such as a compiler error or warning.

Parameters:

Name Type Description Default
range Range

The range at which the message applies.

required
severity Optional[DiagnosticSeverity]

The diagnostic's severity.

required
code Optional[Union[int, str]]

The diagnostic's code, which might appear in the user interface.

required
codeDescription Optional[CodeDescription]

An optional code description.

required
source Optional[str]

A human-readable string describing the source of this diagnostic.

required
message str

The diagnostic's message.

required
tags Optional[List[DiagnosticTag]]

Additional metadata about the diagnostic.

required
relatedInformation Optional[List[DiagnosticRelatedInformation]]

Related diagnostic information.

required
data Optional[Any]

Additional structured data about the diagnostic.

required
Source code in tarts\structs.py
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
class Diagnostic(BaseModel):
    """Represents a diagnostic, such as a compiler error or warning.

    Args:
        range (Range): The range at which the message applies.
        severity (Optional[DiagnosticSeverity]): The diagnostic's severity.
        code (Optional[Union[int, str]]): The diagnostic's code, which might appear in the user interface.
        codeDescription (Optional[CodeDescription]): An optional code description.
        source (Optional[str]): A human-readable string describing the source of this diagnostic.
        message (str): The diagnostic's message.
        tags (Optional[List[DiagnosticTag]]): Additional metadata about the diagnostic.
        relatedInformation (Optional[List[DiagnosticRelatedInformation]]): Related diagnostic information.
        data (Optional[Any]): Additional structured data about the diagnostic.
    """

    range: Range
    severity: t.Optional[DiagnosticSeverity]
    code: t.Optional[t.Union[int, str]]
    codeDescription: t.Optional[CodeDescription]
    source: t.Optional[str]
    message: str
    tags: t.Optional[t.List[DiagnosticTag]]
    relatedInformation: t.Optional[t.List[DiagnosticRelatedInformation]]
    data: t.Optional[t.Any]

DiagnosticRelatedInformation

Bases: BaseModel

Represents additional information related to a diagnostic.

Parameters:

Name Type Description Default
location Location

The location of this related diagnostic information.

required
message str

The message of this related diagnostic information.

required
Source code in tarts\structs.py
515
516
517
518
519
520
521
522
523
524
class DiagnosticRelatedInformation(BaseModel):
    """Represents additional information related to a diagnostic.

    Args:
        location (Location): The location of this related diagnostic information.
        message (str): The message of this related diagnostic information.
    """

    location: Location
    message: str

DiagnosticSeverity

Bases: IntEnum

Enumeration of diagnostic severity levels.

Attributes:

Name Type Description
ERROR int

Error severity level.

WARNING int

Warning severity level.

INFORMATION int

Information severity level.

HINT int

Hint severity level.

Source code in tarts\structs.py
527
528
529
530
531
532
533
534
535
536
537
538
539
540
class DiagnosticSeverity(enum.IntEnum):
    """Enumeration of diagnostic severity levels.

    Attributes:
        ERROR (int): Error severity level.
        WARNING (int): Warning severity level.
        INFORMATION (int): Information severity level.
        HINT (int): Hint severity level.
    """

    ERROR = 1
    WARNING = 2
    INFORMATION = 3
    HINT = 4

DiagnosticTag

Bases: IntEnum

Enumeration of diagnostic tags.

Attributes:

Name Type Description
UNNECESSARY int

Unnecessary code.

DEPRECATED int

Deprecated code.

Source code in tarts\structs.py
553
554
555
556
557
558
559
560
561
562
class DiagnosticTag(enum.IntEnum):
    """Enumeration of diagnostic tags.

    Attributes:
        UNNECESSARY (int): Unnecessary code.
        DEPRECATED (int): Deprecated code.
    """

    UNNECESSARY = 1
    DEPRECATED = 2

DocumentSymbol

Bases: BaseModel

Represents programming constructs like variables, classes, interfaces etc. that appear in a document.

Parameters:

Name Type Description Default
name str

The name of this symbol.

required
detail Optional[str]

More detail for this symbol, e.g. the signature of a function.

required
kind SymbolKind

The kind of this symbol.

required
tags Optional[List[SymbolTag]]

Tags for this symbol.

required
deprecated Optional[bool]

Indicates if this symbol is deprecated.

required
range Range

The range enclosing this symbol not including leading/trailing whitespace but everything else.

required
selectionRange Range

The range that should be selected and revealed when this symbol is being picked.

required
children Optional[List[DocumentSymbol]]

Children of this symbol, e.g. properties of a class.

required
Source code in tarts\structs.py
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
class DocumentSymbol(BaseModel):
    """Represents programming constructs like variables, classes, interfaces etc. that appear in a document.

    Args:
        name (str): The name of this symbol.
        detail (Optional[str]): More detail for this symbol, e.g. the signature of a function.
        kind (SymbolKind): The kind of this symbol.
        tags (Optional[List[SymbolTag]]): Tags for this symbol.
        deprecated (Optional[bool]): Indicates if this symbol is deprecated.
        range (Range): The range enclosing this symbol not including leading/trailing whitespace but everything else.
        selectionRange (Range): The range that should be selected and revealed when this symbol is being picked.
        children (Optional[List[DocumentSymbol]]): Children of this symbol, e.g. properties of a class.
    """

    name: str
    detail: t.Optional[str]
    kind: SymbolKind
    tags: t.Optional[t.List[SymbolTag]]
    deprecated: t.Optional[bool]
    range: Range
    selectionRange: Range
    children: t.Optional[t.List["DocumentSymbol"]]

FoldingRange

Bases: BaseModel

Represents a folding range.

Parameters:

Name Type Description Default
startLine int

The zero-based start line of the range to fold.

required
startCharacter Optional[int]

The zero-based start character of the range to fold.

required
endLine int

The zero-based end line of the range to fold.

required
endCharacter Optional[int]

The zero-based end character of the range to fold.

required
kind Optional[str]

The kind of this folding range (e.g., 'comment', 'imports', 'region').

required
collapsedText Optional[str]

The text that the client should show when the specified range is collapsed.

required
Source code in tarts\structs.py
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
class FoldingRange(BaseModel):
    """Represents a folding range.

    Args:
        startLine (int): The zero-based start line of the range to fold.
        startCharacter (Optional[int]): The zero-based start character of the range to fold.
        endLine (int): The zero-based end line of the range to fold.
        endCharacter (Optional[int]): The zero-based end character of the range to fold.
        kind (Optional[str]): The kind of this folding range (e.g., 'comment', 'imports', 'region').
        collapsedText (Optional[str]): The text that the client should show when the specified range is collapsed.
    """

    startLine: int
    startCharacter: t.Optional[int]
    endLine: int
    endCharacter: t.Optional[int]
    kind: t.Optional[str]  # comment, imports, region
    collapsedText: t.Optional[str]

FormattingOptions

Bases: BaseModel

Represents formatting options.

Parameters:

Name Type Description Default
tabSize int

Size of a tab in spaces.

required
insertSpaces bool

Prefer spaces over tabs.

required
trimTrailingWhitespace Optional[bool]

Trim trailing whitespace on a line.

required
insertFinalNewline Optional[bool]

Insert a newline character at the end of the file if one does not exist.

required
trimFinalNewlines Optional[bool]

Trim all newlines after the final newline at the end of the file.

required
Source code in tarts\structs.py
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
class FormattingOptions(BaseModel):
    """Represents formatting options.

    Args:
        tabSize (int): Size of a tab in spaces.
        insertSpaces (bool): Prefer spaces over tabs.
        trimTrailingWhitespace (Optional[bool]): Trim trailing whitespace on a line.
        insertFinalNewline (Optional[bool]): Insert a newline character at the end of the file if one does not exist.
        trimFinalNewlines (Optional[bool]): Trim all newlines after the final newline at the end of the file.
    """

    tabSize: int
    insertSpaces: bool
    trimTrailingWhitespace: t.Optional[bool]
    insertFinalNewline: t.Optional[bool]
    trimFinalNewlines: t.Optional[bool]

InlayHint

Bases: BaseModel

Represents an inlay hint.

Parameters:

Name Type Description Default
position Position

The position of this hint.

required
label Union[str, List[InlayHintLabelPart]]

The label of this hint.

required
kind Optional[InlayHintKind]

The kind of this hint.

required
textEdits Optional[List[TextEdit]]

Optional text edits that are performed when accepting this inlay hint.

required
tooltip Optional[Union[str, MarkupContent]]

The tooltip text when you hover over this item.

required
paddingLeft Optional[bool]

Whether the inlay hint should be padded with a space on the left.

required
paddingRight Optional[bool]

Whether the inlay hint should be padded with a space on the right.

required
data Optional[Any]

A data entry field that is preserved on an inlay hint between a textDocument/inlayHint request and a inlayHint/resolve request.

required
Source code in tarts\structs.py
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
class InlayHint(BaseModel):
    """Represents an inlay hint.

    Args:
        position (Position): The position of this hint.
        label (Union[str, List[InlayHintLabelPart]]): The label of this hint.
        kind (Optional[InlayHintKind]): The kind of this hint.
        textEdits (Optional[List[TextEdit]]): Optional text edits that are performed when accepting this inlay hint.
        tooltip (Optional[Union[str, MarkupContent]]): The tooltip text when you hover over this item.
        paddingLeft (Optional[bool]): Whether the inlay hint should be padded with a space on the left.
        paddingRight (Optional[bool]): Whether the inlay hint should be padded with a space on the right.
        data (Optional[Any]): A data entry field that is preserved on an inlay hint between a textDocument/inlayHint request and a inlayHint/resolve request.
    """

    position: Position
    label: t.Union[str, t.List[InlayHintLabelPart]]
    kind: t.Optional[InlayHintKind]
    textEdits: t.Optional[t.List[TextEdit]]
    tooltip: t.Optional[t.Union[str, MarkupContent]]
    paddingLeft: t.Optional[bool]
    paddingRight: t.Optional[bool]
    data: t.Optional[t.Any]

InlayHintKind

Bases: IntEnum

Enumeration of inlay hint kinds.

Attributes:

Name Type Description
TYPE int

Type hint.

PARAMETER int

Parameter hint.

Source code in tarts\structs.py
803
804
805
806
807
808
809
810
811
812
class InlayHintKind(enum.IntEnum):
    """Enumeration of inlay hint kinds.

    Attributes:
        TYPE (int): Type hint.
        PARAMETER (int): Parameter hint.
    """

    TYPE = 1
    PARAMETER = 2

InlayHintLabelPart

Bases: BaseModel

Represents a part of an inlay hint.

Parameters:

Name Type Description Default
value str

The value of this label part.

required
tooltip Optional[Union[str, MarkupContent]]

The tooltip text when you hover over this label part.

required
location Optional[Location]

An optional source code location that represents this label part.

required
command Optional[Command]

An optional command for this label part.

required
Source code in tarts\structs.py
787
788
789
790
791
792
793
794
795
796
797
798
799
800
class InlayHintLabelPart(BaseModel):
    """Represents a part of an inlay hint.

    Args:
        value (str): The value of this label part.
        tooltip (Optional[Union[str, MarkupContent]]): The tooltip text when you hover over this label part.
        location (Optional[Location]): An optional source code location that represents this label part.
        command (Optional[Command]): An optional command for this label part.
    """

    value: str
    tooltip: t.Optional[t.Union[str, MarkupContent]]
    location: t.Optional[Location]
    command: t.Optional[Command]

InsertTextFormat

Bases: IntEnum

Defines whether the insert text in a completion item should be interpreted as plain text or a snippet.

Attributes:

Name Type Description
PLAIN_TEXT

The primary text should be interpreted as plain text.

SNIPPET

The primary text should be interpreted as a snippet.

Source code in tarts\structs.py
365
366
367
368
369
370
371
372
373
374
class InsertTextFormat(enum.IntEnum):
    """Defines whether the insert text in a completion item should be interpreted as plain text or a snippet.

    Attributes:
        PLAIN_TEXT: The primary text should be interpreted as plain text.
        SNIPPET: The primary text should be interpreted as a snippet.
    """

    PLAIN_TEXT = 1
    SNIPPET = 2

Location

Bases: BaseModel

Represents a location inside a resource, such as a line inside a text file.

Parameters:

Name Type Description Default
uri str

The text document's URI.

required
range Range

The range inside the text document.

required
Source code in tarts\structs.py
487
488
489
490
491
492
493
494
495
496
class Location(BaseModel):
    """Represents a location inside a resource, such as a line inside a text file.

    Args:
        uri (str): The text document's URI.
        range (Range): The range inside the text document.
    """

    uri: str
    range: Range

Bases: BaseModel

Represents a link between a source and a target location.

Parameters:

Name Type Description Default
originSelectionRange Optional[Range]

Span of the origin of this link.

required
targetUri str

The target resource identifier of this link.

required
targetRange Range

The full target range of this link.

required
targetSelectionRange Range

The span of the target of this link.

required
Source code in tarts\structs.py
499
500
501
502
503
504
505
506
507
508
509
510
511
512
class LocationLink(BaseModel):
    """Represents a link between a source and a target location.

    Args:
        originSelectionRange (Optional[Range]): Span of the origin of this link.
        targetUri (str): The target resource identifier of this link.
        targetRange (Range): The full target range of this link.
        targetSelectionRange (Range): The span of the target of this link.
    """

    originSelectionRange: t.Optional[Range]
    targetUri: str  # in the spec the type is DocumentUri
    targetRange: Range
    targetSelectionRange: Range

MWorkDoneProgressKind

Bases: Enum

Enumeration of work done progress kinds.

Source code in tarts\structs.py
942
943
944
945
946
947
class MWorkDoneProgressKind(enum.Enum):
    """Enumeration of work done progress kinds."""

    BEGIN = "begin"
    REPORT = "report"
    END = "end"

MarkedString

Bases: BaseModel

Represents a string with a specific language.

Parameters:

Name Type Description Default
language str

The language of the string (e.g., 'python', 'javascript').

required
value str

The string value.

required
Source code in tarts\structs.py
591
592
593
594
595
596
597
598
599
600
class MarkedString(BaseModel):
    """Represents a string with a specific language.

    Args:
        language (str): The language of the string (e.g., 'python', 'javascript').
        value (str): The string value.
    """

    language: str
    value: str

MarkupContent

Bases: BaseModel

Represents a string value which content can be represented in different formats.

Parameters:

Name Type Description Default
kind MarkupKind

The type of markup used.

required
value str

The content itself.

required
Source code in tarts\structs.py
313
314
315
316
317
318
319
320
321
322
class MarkupContent(BaseModel):
    """Represents a string value which content can be represented in different formats.

    Args:
        kind (MarkupKind): The type of markup used.
        value (str): The content itself.
    """

    kind: MarkupKind
    value: str

MarkupKind

Bases: Enum

Describes the content type that a client supports in various result literals like Hover, ParameterInfo or CompletionItem.

Attributes:

Name Type Description
PLAINTEXT

The primary text to be rendered is to be interpreted as plain text.

MARKDOWN

The primary text to be rendered is to be interpreted as Markdown.

Source code in tarts\structs.py
301
302
303
304
305
306
307
308
309
310
class MarkupKind(enum.Enum):
    """Describes the content type that a client supports in various result literals like `Hover`, `ParameterInfo` or `CompletionItem`.

    Attributes:
        PLAINTEXT: The primary text to be rendered is to be interpreted as plain text.
        MARKDOWN: The primary text to be rendered is to be interpreted as Markdown.
    """

    PLAINTEXT = "plaintext"
    MARKDOWN = "markdown"

MessageActionItem

Bases: BaseModel

Action item for LSP notifications.

Parameters:

Name Type Description Default
title(str)

The title of the action.

required
Source code in tarts\structs.py
66
67
68
69
70
71
72
73
class MessageActionItem(BaseModel):
    """Action item for LSP notifications.

    Args:
        title(str): The title of the action.
    """

    title: str

MessageType

Bases: IntEnum

Message type for LSP notifications.

Attributes:

Name Type Description
ERROR int

Error message.

WARNING int

Warning message.

INFO int

Information message.

LOG int

Log message.

Source code in tarts\structs.py
50
51
52
53
54
55
56
57
58
59
60
61
62
63
class MessageType(enum.IntEnum):
    """Message type for LSP notifications.

    Attributes:
        ERROR: Error message.
        WARNING: Warning message.
        INFO: Information message.
        LOG: Log message.
    """

    ERROR: int = 1
    WARNING: int = 2
    INFO: int = 3
    LOG: int = 4

OptionalVersionedTextDocumentIdentifier

Bases: TextDocumentIdentifier

Text document identifier with an optional version for LSP requests.

Parameters:

Name Type Description Default
uri(str)

The URI of the document

required
version(int)

The version of the document

required
Source code in tarts\structs.py
102
103
104
105
106
107
108
109
110
class OptionalVersionedTextDocumentIdentifier(TextDocumentIdentifier):
    """Text document identifier with an optional version for LSP requests.

    Args:
        uri(str): The URI of the document
        version(int): The version of the document
    """

    version: t.Optional[int]

ParameterInformation

Bases: BaseModel

Represents information about a parameter of a callable-signature.

Parameters:

Name Type Description Default
label Union[str, Tuple[int, int]]

The label of this parameter information.

required
documentation Optional[Union[str, MarkupContent]]

The human-readable doc-comment of this parameter.

required
Source code in tarts\structs.py
603
604
605
606
607
608
609
610
611
612
class ParameterInformation(BaseModel):
    """Represents information about a parameter of a callable-signature.

    Args:
        label (Union[str, Tuple[int, int]]): The label of this parameter information.
        documentation (Optional[Union[str, MarkupContent]]): The human-readable doc-comment of this parameter.
    """

    label: t.Union[str, t.Tuple[int, int]]
    documentation: t.Optional[t.Union[str, MarkupContent]]

Position

Bases: BaseModel

Position in a text document.

Methods:

Name Description
as_tuple

Return the position as a tuple.

Parameters:

Name Type Description Default
line int

The line number (0-based).

required
character int

The character number (0-based).

required
Source code in tarts\structs.py
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
class Position(BaseModel):
    """Position in a text document.

    Methods:
        as_tuple: Return the position as a tuple.

    Args:
        line (int): The line number (0-based).
        character (int): The character number (0-based).
    """

    # NB: These are both zero-based.
    line: int
    character: int

    def as_tuple(self) -> t.Tuple[int, int]:
        """Return the position as a tuple.

        Returns:
            Tuple[int, int]: The position as a tuple.
        """

        return (self.line, self.character)

as_tuple()

Return the position as a tuple.

Returns:

Type Description
Tuple[int, int]

Tuple[int, int]: The position as a tuple.

Source code in tarts\structs.py
140
141
142
143
144
145
146
147
def as_tuple(self) -> t.Tuple[int, int]:
    """Return the position as a tuple.

    Returns:
        Tuple[int, int]: The position as a tuple.
    """

    return (self.line, self.character)

ProgressValue

Bases: BaseModel

Base class for progress values.

Source code in tarts\structs.py
930
931
932
933
class ProgressValue(BaseModel):
    """Base class for progress values."""

    pass

Range

Bases: BaseModel

Represents a range in a text document.

Parameters:

Name Type Description Default
start Position

The start position of the range.

required
end Position

The end position of the range.

required
Source code in tarts\structs.py
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
class Range(BaseModel):
    """Represents a range in a text document.

    Args:
        start (Position): The start position of the range.
        end (Position): The end position of the range.
    """

    start: Position
    end: Position

    def calculate_length(self, text: str) -> int:
        """Calculate the length of the range in the given text.

        Args:
            text (str): The text to calculate the range length in.

        Returns:
            int: The length of the range.
        """
        text_lines = text.splitlines()

        if self.end.line == self.start.line:
            line = text_lines[self.start.line]
            return len(line[self.start.character : self.end.character])
        else:
            total = 0

            total += len(text_lines[self.start.line][self.start.character :])

            for line_number in range(self.start.line + 1, self.end.line):
                total += len(text_lines[line_number])

            total += len(text_lines[self.end.line][: self.end.character])

            return total

calculate_length(text)

Calculate the length of the range in the given text.

Parameters:

Name Type Description Default
text str

The text to calculate the range length in.

required

Returns:

Name Type Description
int int

The length of the range.

Source code in tarts\structs.py
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
def calculate_length(self, text: str) -> int:
    """Calculate the length of the range in the given text.

    Args:
        text (str): The text to calculate the range length in.

    Returns:
        int: The length of the range.
    """
    text_lines = text.splitlines()

    if self.end.line == self.start.line:
        line = text_lines[self.start.line]
        return len(line[self.start.character : self.end.character])
    else:
        total = 0

        total += len(text_lines[self.start.line][self.start.character :])

        for line_number in range(self.start.line + 1, self.end.line):
            total += len(text_lines[line_number])

        total += len(text_lines[self.end.line][: self.end.character])

        return total

Registration

Bases: BaseModel

Represents a registration of a capability.

Parameters:

Name Type Description Default
id str

The id used to register the request. The id can be used to deregister the request again.

required
method str

The method / capability to register for.

required
registerOptions Optional[Any]

Options necessary for the registration.

required
Source code in tarts\structs.py
886
887
888
889
890
891
892
893
894
895
896
897
class Registration(BaseModel):
    """Represents a registration of a capability.

    Args:
        id (str): The id used to register the request. The id can be used to deregister the request again.
        method (str): The method / capability to register for.
        registerOptions (Optional[Any]): Options necessary for the registration.
    """

    id: str
    method: str
    registerOptions: t.Optional[t.Any]

Request

Bases: BaseModel

Base class for LSP requests.

Parameters:

Name Type Description Default
method(str)

The method of the request.

required
id Id

The request ID.

required
params JSONDict

The parameters of the request.

required
Source code in tarts\structs.py
20
21
22
23
24
25
26
27
28
29
30
31
class Request(BaseModel):
    """Base class for LSP requests.

    Args:
        method(str): The method of the request.
        id (Id): The request ID.
        params (JSONDict): The parameters of the request.
    """

    method: str
    id: t.Optional[Id]
    params: t.Optional[JSONDict]

Response

Bases: BaseModel

Base class for LSP responses.

The result field is either a list of values or a dictionary.

Parameters:

Name Type Description Default
id Id

The request ID.

required
result(List[Any] | JSONDict

The result of the request.

required
error

The error that occurred during the request.

required
Source code in tarts\structs.py
34
35
36
37
38
39
40
41
42
43
44
45
46
47
class Response(BaseModel):
    """Base class for LSP responses.

    The `result` field is either a list of values or a dictionary.

    Args:
        id (Id): The request ID.
        result(List[Any] | JSONDict): The result of the request.
        error: The error that occurred during the request.
    """

    id: t.Optional[Id]
    result: t.Optional[t.Union[t.List[t.Any], JSONDict]]
    error: t.Optional[JSONDict]

SignatureInformation

Bases: BaseModel

Represents the signature of something callable.

Parameters:

Name Type Description Default
label str

The label of this signature.

required
documentation Optional[Union[MarkupContent, str]]

The human-readable doc-comment of this signature.

required
parameters Optional[List[ParameterInformation]]

The parameters of this signature.

required
activeParameter Optional[int]

The index of the active parameter.

required
Source code in tarts\structs.py
615
616
617
618
619
620
621
622
623
624
625
626
627
628
class SignatureInformation(BaseModel):
    """Represents the signature of something callable.

    Args:
        label (str): The label of this signature.
        documentation (Optional[Union[MarkupContent, str]]): The human-readable doc-comment of this signature.
        parameters (Optional[List[ParameterInformation]]): The parameters of this signature.
        activeParameter (Optional[int]): The index of the active parameter.
    """

    label: str
    documentation: t.Optional[t.Union[MarkupContent, str]]
    parameters: t.Optional[t.List[ParameterInformation]]
    activeParameter: t.Optional[int]

SymbolInformation

Bases: BaseModel

Represents information about programming constructs like variables, classes, interfaces etc.

Parameters:

Name Type Description Default
name str

The name of this symbol.

required
kind SymbolKind

The kind of this symbol.

required
tags Optional[List[SymbolTag]]

Tags for this symbol.

required
deprecated Optional[bool]

Indicates if this symbol is deprecated.

required
location Location

The location of this symbol.

required
containerName Optional[str]

The name of the symbol containing this symbol.

required
Source code in tarts\structs.py
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
class SymbolInformation(BaseModel):
    """Represents information about programming constructs like variables, classes, interfaces etc.

    Args:
        name (str): The name of this symbol.
        kind (SymbolKind): The kind of this symbol.
        tags (Optional[List[SymbolTag]]): Tags for this symbol.
        deprecated (Optional[bool]): Indicates if this symbol is deprecated.
        location (Location): The location of this symbol.
        containerName (Optional[str]): The name of the symbol containing this symbol.
    """

    name: str
    kind: SymbolKind
    tags: t.Optional[t.List[SymbolTag]]
    deprecated: t.Optional[bool]
    location: Location
    containerName: t.Optional[str]

SymbolKind

Bases: IntEnum

Enumeration of symbol kinds.

Attributes:

Name Type Description
FILE int

A file symbol.

MODULE int

A module symbol.

NAMESPACE int

A namespace symbol.

PACKAGE int

A package symbol.

CLASS int

A class symbol.

METHOD int

A method symbol.

PROPERTY int

A property symbol.

FIELD int

A field symbol.

CONSTRUCTOR int

A constructor symbol.

ENUM int

An enum symbol.

INTERFACE int

An interface symbol.

FUNCTION int

A function symbol.

VARIABLE int

A variable symbol.

CONSTANT int

A constant symbol.

STRING int

A string symbol.

NUMBER int

A number symbol.

BOOLEAN int

A boolean symbol.

ARRAY int

An array symbol.

OBJECT int

An object symbol.

KEY int

A key symbol.

NULL int

A null symbol.

ENUMMEMBER int

An enum member symbol.

STRUCT int

A struct symbol.

EVENT int

An event symbol.

OPERATOR int

An operator symbol.

TYPEPARAMETER int

A type parameter symbol.

Source code in tarts\structs.py
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
class SymbolKind(enum.IntEnum):
    """Enumeration of symbol kinds.

    Attributes:
        FILE (int): A file symbol.
        MODULE (int): A module symbol.
        NAMESPACE (int): A namespace symbol.
        PACKAGE (int): A package symbol.
        CLASS (int): A class symbol.
        METHOD (int): A method symbol.
        PROPERTY (int): A property symbol.
        FIELD (int): A field symbol.
        CONSTRUCTOR (int): A constructor symbol.
        ENUM (int): An enum symbol.
        INTERFACE (int): An interface symbol.
        FUNCTION (int): A function symbol.
        VARIABLE (int): A variable symbol.
        CONSTANT (int): A constant symbol.
        STRING (int): A string symbol.
        NUMBER (int): A number symbol.
        BOOLEAN (int): A boolean symbol.
        ARRAY (int): An array symbol.
        OBJECT (int): An object symbol.
        KEY (int): A key symbol.
        NULL (int): A null symbol.
        ENUMMEMBER (int): An enum member symbol.
        STRUCT (int): A struct symbol.
        EVENT (int): An event symbol.
        OPERATOR (int): An operator symbol.
        TYPEPARAMETER (int): A type parameter symbol.
    """

    FILE = 1
    MODULE = 2
    NAMESPACE = 3
    PACKAGE = 4
    CLASS = 5
    METHOD = 6
    PROPERTY = 7
    FIELD = 8
    CONSTRUCTOR = 9
    ENUM = 10
    INTERFACE = 11
    FUNCTION = 12
    VARIABLE = 13
    CONSTANT = 14
    STRING = 15
    NUMBER = 16
    BOOLEAN = 17
    ARRAY = 18
    OBJECT = 19
    KEY = 20
    NULL = 21
    ENUMMEMBER = 22
    STRUCT = 23
    EVENT = 24
    OPERATOR = 25
    TYPEPARAMETER = 26

SymbolTag

Bases: IntEnum

Enumeration of symbol tags.

Attributes:

Name Type Description
DEPRECATED int

Indicates that a symbol is deprecated.

Source code in tarts\structs.py
691
692
693
694
695
696
697
698
class SymbolTag(enum.IntEnum):
    """Enumeration of symbol tags.

    Attributes:
        DEPRECATED (int): Indicates that a symbol is deprecated.
    """

    DEPRECATED = 1

TextDocumentContentChangeEvent

Bases: BaseModel

Represents a content change event in a text document.

Parameters:

Name Type Description Default
text str

The new text of the document.

required
range Optional[Range]

The range of the document that changed.

required
rangeLength Optional[int]

The length of the range that changed (deprecated, use .range).

required
Source code in tarts\structs.py
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
class TextDocumentContentChangeEvent(BaseModel):
    """Represents a content change event in a text document.

    Args:
        text (str): The new text of the document.
        range (Optional[Range]): The range of the document that changed.
        rangeLength (Optional[int]): The length of the range that changed (deprecated, use .range).
    """

    text: str
    range: t.Optional[Range]
    rangeLength: t.Optional[int]  # deprecated, use .range

    def dict(self, **kwargs: t.Any) -> t.Dict[str, t.Any]:
        """Return a dictionary representation of the event.

        Returns:
            Dict[str, Any]: A dictionary representation of the event.
        """
        d = super().dict(**kwargs)

        # vscode-css server requires un-filled values to be absent
        # TODO: add vscode-css to tests
        if self.rangeLength is None:
            del d["rangeLength"]
        if self.range is None:
            del d["range"]
        return d

    @classmethod
    def range_change(
        cls,
        change_start: Position,
        change_end: Position,
        change_text: str,
        old_text: str,
    ) -> "TextDocumentContentChangeEvent":
        """
        Create a TextDocumentContentChangeEvent reflecting the given changes.

        Args:
            change_start (Position): The start position of the change.
            change_end (Position): The end position of the change.
            change_text (str): The new text for the changed range.
            old_text (str): The old text of the document.

        Returns:
            TextDocumentContentChangeEvent: A new instance representing the change.

        Note:
            If you're creating a list of TextDocumentContentChangeEvent based on many changes,
            `old_text` must reflect the state of the text after all previous change events happened.
        """
        change_range = Range(start=change_start, end=change_end)
        return cls(
            range=change_range,
            rangeLength=change_range.calculate_length(old_text),
            text=change_text,
        )

    @classmethod
    def whole_document_change(
        cls, change_text: str
    ) -> "TextDocumentContentChangeEvent":
        """Create a TextDocumentContentChangeEvent for a whole document change.

        Args:
            change_text (str): The new text of the entire document.

        Returns:
            TextDocumentContentChangeEvent: A new instance representing the whole document change.
        """
        return cls(text=change_text)

dict(**kwargs)

Return a dictionary representation of the event.

Returns:

Type Description
Dict[str, Any]

Dict[str, Any]: A dictionary representation of the event.

Source code in tarts\structs.py
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
def dict(self, **kwargs: t.Any) -> t.Dict[str, t.Any]:
    """Return a dictionary representation of the event.

    Returns:
        Dict[str, Any]: A dictionary representation of the event.
    """
    d = super().dict(**kwargs)

    # vscode-css server requires un-filled values to be absent
    # TODO: add vscode-css to tests
    if self.rangeLength is None:
        del d["rangeLength"]
    if self.range is None:
        del d["range"]
    return d

range_change(change_start, change_end, change_text, old_text) classmethod

Create a TextDocumentContentChangeEvent reflecting the given changes.

Parameters:

Name Type Description Default
change_start Position

The start position of the change.

required
change_end Position

The end position of the change.

required
change_text str

The new text for the changed range.

required
old_text str

The old text of the document.

required

Returns:

Name Type Description
TextDocumentContentChangeEvent TextDocumentContentChangeEvent

A new instance representing the change.

Note

If you're creating a list of TextDocumentContentChangeEvent based on many changes, old_text must reflect the state of the text after all previous change events happened.

Source code in tarts\structs.py
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
@classmethod
def range_change(
    cls,
    change_start: Position,
    change_end: Position,
    change_text: str,
    old_text: str,
) -> "TextDocumentContentChangeEvent":
    """
    Create a TextDocumentContentChangeEvent reflecting the given changes.

    Args:
        change_start (Position): The start position of the change.
        change_end (Position): The end position of the change.
        change_text (str): The new text for the changed range.
        old_text (str): The old text of the document.

    Returns:
        TextDocumentContentChangeEvent: A new instance representing the change.

    Note:
        If you're creating a list of TextDocumentContentChangeEvent based on many changes,
        `old_text` must reflect the state of the text after all previous change events happened.
    """
    change_range = Range(start=change_start, end=change_end)
    return cls(
        range=change_range,
        rangeLength=change_range.calculate_length(old_text),
        text=change_text,
    )

whole_document_change(change_text) classmethod

Create a TextDocumentContentChangeEvent for a whole document change.

Parameters:

Name Type Description Default
change_text str

The new text of the entire document.

required

Returns:

Name Type Description
TextDocumentContentChangeEvent TextDocumentContentChangeEvent

A new instance representing the whole document change.

Source code in tarts\structs.py
248
249
250
251
252
253
254
255
256
257
258
259
260
@classmethod
def whole_document_change(
    cls, change_text: str
) -> "TextDocumentContentChangeEvent":
    """Create a TextDocumentContentChangeEvent for a whole document change.

    Args:
        change_text (str): The new text of the entire document.

    Returns:
        TextDocumentContentChangeEvent: A new instance representing the whole document change.
    """
    return cls(text=change_text)

TextDocumentEdit

Bases: BaseModel

Describes textual changes on a single text document.

Parameters:

Name Type Description Default
textDocument OptionalVersionedTextDocumentIdentifier

The text document to change.

required
edits List[TextEdit]

The edits to be applied.

required
Source code in tarts\structs.py
339
340
341
342
343
344
345
346
347
348
class TextDocumentEdit(BaseModel):
    """Describes textual changes on a single text document.

    Args:
        textDocument (OptionalVersionedTextDocumentIdentifier): The text document to change.
        edits (List[TextEdit]): The edits to be applied.
    """

    textDocument: OptionalVersionedTextDocumentIdentifier
    edits: t.List[TextEdit]

TextDocumentIdentifier

Bases: BaseModel

Text document identifier for LSP requests.

Parameters:

Name Type Description Default
uri(str)

The URI of the document

required
Source code in tarts\structs.py
92
93
94
95
96
97
98
99
class TextDocumentIdentifier(BaseModel):
    """Text document identifier for LSP requests.

    Args:
        uri(str): The URI of the document
    """

    uri: str

TextDocumentItem

Bases: BaseModel

Text document item for LSP notifications.

Parameters:

Name Type Description Default
uri(str)

The URI of the document.

required
languageId(str)

The language ID of the document.

required
version(int)

The version of the document.

required
text(str)

The text of the document.

required
Source code in tarts\structs.py
76
77
78
79
80
81
82
83
84
85
86
87
88
89
class TextDocumentItem(BaseModel):
    """Text document item for LSP notifications.

    Args:
        uri(str): The URI of the document.
        languageId(str): The language ID of the document.
        version(int): The version of the document.
        text(str): The text of the document.
    """

    uri: str
    languageId: str
    version: int
    text: str

TextDocumentPosition

Bases: BaseModel

Represents a position in a text document.

Parameters:

Name Type Description Default
textDocument TextDocumentIdentifier

The text document.

required
position Position

The position inside the text document.

required
Source code in tarts\structs.py
263
264
265
266
267
268
269
270
271
272
class TextDocumentPosition(BaseModel):
    """Represents a position in a text document.

    Args:
        textDocument (TextDocumentIdentifier): The text document.
        position (Position): The position inside the text document.
    """

    textDocument: TextDocumentIdentifier
    position: Position

TextDocumentSaveReason

Bases: IntEnum

Represents reasons why a text document is saved.

Attributes:

Name Type Description
MANUAL

Manually triggered, e.g. by the user pressing save, by starting debugging, or by an API call.

AFTER_DELAY

Automatic after a delay.

FOCUS_OUT

When the editor lost focus.

Source code in tarts\structs.py
473
474
475
476
477
478
479
480
481
482
483
484
class TextDocumentSaveReason(enum.IntEnum):
    """Represents reasons why a text document is saved.

    Attributes:
        MANUAL: Manually triggered, e.g. by the user pressing save, by starting debugging, or by an API call.
        AFTER_DELAY: Automatic after a delay.
        FOCUS_OUT: When the editor lost focus.
    """

    MANUAL = 1
    AFTER_DELAY = 2
    FOCUS_OUT = 3

TextDocumentSyncKind

Bases: IntEnum

Enumeration of text document synchronization kinds.

Attributes:

Name Type Description
NONE int

Documents should not be synced at all.

FULL int

Documents are synced by always sending the full content of the document.

INCREMENTAL int

Documents are synced by sending incremental updates to the document.

Source code in tarts\structs.py
753
754
755
756
757
758
759
760
761
762
763
764
class TextDocumentSyncKind(enum.IntEnum):
    """Enumeration of text document synchronization kinds.

    Attributes:
        NONE (int): Documents should not be synced at all.
        FULL (int): Documents are synced by always sending the full content of the document.
        INCREMENTAL (int): Documents are synced by sending incremental updates to the document.
    """

    NONE = 0
    FULL = 1
    INCREMENTAL = 2

TextEdit

Bases: BaseModel

A text edit applicable to a text document.

Parameters:

Name Type Description Default
range Range

The range of the text document to be manipulated.

required
newText str

The string to be inserted. For delete operations use an empty string.

required
annotationId Optional[str]

An optional identifier of the edit.

required
Source code in tarts\structs.py
325
326
327
328
329
330
331
332
333
334
335
336
class TextEdit(BaseModel):
    """A text edit applicable to a text document.

    Args:
        range (Range): The range of the text document to be manipulated.
        newText (str): The string to be inserted. For delete operations use an empty string.
        annotationId (Optional[str]): An optional identifier of the edit.
    """

    range: Range
    newText: str
    annotationId: t.Optional[str]

VersionedTextDocumentIdentifier

Bases: TextDocumentIdentifier

Text document identifier with a version for LSP notifications.

Parameters:

Name Type Description Default
uri(str)

The URI of the document

required
version(int)

The version of the document

required
Source code in tarts\structs.py
113
114
115
116
117
118
119
120
121
class VersionedTextDocumentIdentifier(TextDocumentIdentifier):
    """Text document identifier with a version for LSP notifications.

    Args:
        uri(str): The URI of the document
        version(int): The version of the document
    """

    version: t.Optional[int]

WorkDoneProgressBeginValue

Bases: WorkDoneProgressValue

Represents the beginning of a work done progress.

Parameters:

Name Type Description Default
kind Literal['begin']

The kind of progress (always "begin" for this class).

required
title str

The title of the progress operation.

required
cancellable Optional[bool]

Whether the operation is cancellable.

required
message Optional[str]

An optional message providing additional details.

required
percentage Optional[int]

An optional initial percentage of the progress.

required
Source code in tarts\structs.py
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
class WorkDoneProgressBeginValue(WorkDoneProgressValue):
    """Represents the beginning of a work done progress.

    Args:
        kind (Literal["begin"]): The kind of progress (always "begin" for this class).
        title (str): The title of the progress operation.
        cancellable (Optional[bool]): Whether the operation is cancellable.
        message (Optional[str]): An optional message providing additional details.
        percentage (Optional[int]): An optional initial percentage of the progress.
    """

    kind: Literal["begin"]
    title: str
    cancellable: t.Optional[bool]
    message: t.Optional[str]
    percentage: t.Optional[int]

WorkDoneProgressEndValue

Bases: WorkDoneProgressValue

Represents the end of a work done progress.

Parameters:

Name Type Description Default
kind Literal['end']

The kind of progress (always "end" for this class).

required
message Optional[str]

An optional message providing final details or results.

required
Source code in tarts\structs.py
984
985
986
987
988
989
990
991
992
993
class WorkDoneProgressEndValue(WorkDoneProgressValue):
    """Represents the end of a work done progress.

    Args:
        kind (Literal["end"]): The kind of progress (always "end" for this class).
        message (Optional[str]): An optional message providing final details or results.
    """

    kind: Literal["end"]
    message: t.Optional[str]

WorkDoneProgressReportValue

Bases: WorkDoneProgressValue

Represents a report of ongoing work done progress.

Parameters:

Name Type Description Default
kind Literal['report']

The kind of progress (always "report" for this class).

required
cancellable Optional[bool]

Whether the operation is cancellable.

required
message Optional[str]

An optional message providing additional details.

required
percentage Optional[int]

An optional updated percentage of the progress.

required
Source code in tarts\structs.py
968
969
970
971
972
973
974
975
976
977
978
979
980
981
class WorkDoneProgressReportValue(WorkDoneProgressValue):
    """Represents a report of ongoing work done progress.

    Args:
        kind (Literal["report"]): The kind of progress (always "report" for this class).
        cancellable (Optional[bool]): Whether the operation is cancellable.
        message (Optional[str]): An optional message providing additional details.
        percentage (Optional[int]): An optional updated percentage of the progress.
    """

    kind: Literal["report"]
    cancellable: t.Optional[bool]
    message: t.Optional[str]
    percentage: t.Optional[int]

WorkDoneProgressValue

Bases: ProgressValue

Base class for work done progress values.

Source code in tarts\structs.py
936
937
938
939
class WorkDoneProgressValue(ProgressValue):
    """Base class for work done progress values."""

    pass

WorkspaceFolder

Bases: BaseModel

Represents a workspace folder.

Parameters:

Name Type Description Default
uri str

The associated URI for this workspace folder.

required
name str

The name of the workspace folder.

required
Source code in tarts\structs.py
918
919
920
921
922
923
924
925
926
927
class WorkspaceFolder(BaseModel):
    """Represents a workspace folder.

    Args:
        uri (str): The associated URI for this workspace folder.
        name (str): The name of the workspace folder.
    """

    uri: str
    name: str