Skip to content

Commit 3879031

Browse files
committed
add pull diagnostic types to lsp types
1 parent eba5cbe commit 3879031

File tree

2 files changed

+118
-0
lines changed

2 files changed

+118
-0
lines changed

robotcode/language_server/common/lsp_types.py

Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2202,3 +2202,118 @@ class InlineValueEvaluatableExpression(Model):
22022202

22032203

22042204
InlineValue = Union[InlineValueText, InlineValueVariableLookup, InlineValueEvaluatableExpression]
2205+
2206+
2207+
@dataclass(repr=False)
2208+
class _DocumentDiagnosticParams(Model):
2209+
text_document: TextDocumentIdentifier
2210+
identifier: Optional[str] = None
2211+
previous_result_id: Optional[str] = None
2212+
2213+
2214+
@dataclass(repr=False)
2215+
class DocumentDiagnosticParams(WorkDoneProgressParams, PartialResultParams, _DocumentDiagnosticParams):
2216+
pass
2217+
2218+
2219+
class DocumentDiagnosticReportKind(Enum):
2220+
FULL = "full"
2221+
UNCHANGED = "unchanged"
2222+
2223+
2224+
@dataclass(repr=False)
2225+
class FullDocumentDiagnosticReport(Model):
2226+
items: List[Diagnostic]
2227+
result_id: Optional[str] = None
2228+
kind: Literal[DocumentDiagnosticReportKind.FULL] = DocumentDiagnosticReportKind.FULL
2229+
2230+
2231+
@dataclass(repr=False)
2232+
class UnchangedDocumentDiagnosticReport(Model):
2233+
result_id: str
2234+
kind: DocumentDiagnosticReportKind = DocumentDiagnosticReportKind.UNCHANGED
2235+
2236+
2237+
@dataclass(repr=False)
2238+
class RelatedFullDocumentDiagnosticReport(FullDocumentDiagnosticReport):
2239+
related_documents: Optional[
2240+
Dict[DocumentUri, Union[FullDocumentDiagnosticReport, UnchangedDocumentDiagnosticReport]]
2241+
] = None
2242+
2243+
2244+
@dataclass(repr=False)
2245+
class RelatedUnchangedDocumentDiagnosticReport(UnchangedDocumentDiagnosticReport):
2246+
related_documents: Optional[
2247+
Dict[DocumentUri, Union[FullDocumentDiagnosticReport, UnchangedDocumentDiagnosticReport]]
2248+
] = None
2249+
2250+
2251+
DocumentDiagnosticReport = Union[RelatedFullDocumentDiagnosticReport, RelatedUnchangedDocumentDiagnosticReport]
2252+
2253+
2254+
@dataclass(repr=False)
2255+
class DocumentDiagnosticReportPartialResult(Model):
2256+
related_documents: Optional[
2257+
Dict[DocumentUri, Union[FullDocumentDiagnosticReport, UnchangedDocumentDiagnosticReport]]
2258+
] = None
2259+
2260+
2261+
@dataclass(repr=False)
2262+
class DiagnosticServerCancellationData(Model):
2263+
retrigger_request: bool
2264+
2265+
2266+
@dataclass(repr=False)
2267+
class PreviousResultId(Model):
2268+
uri: DocumentUri
2269+
value: str
2270+
2271+
2272+
@dataclass(repr=False)
2273+
class _WorkspaceDiagnosticParams(Model):
2274+
previous_result_ids: List[PreviousResultId]
2275+
identifier: Optional[str] = None
2276+
2277+
2278+
@dataclass(repr=False)
2279+
class WorkspaceDiagnosticParams(WorkDoneProgressParams, PartialResultParams, _WorkspaceDiagnosticParams):
2280+
pass
2281+
2282+
2283+
@dataclass(repr=False)
2284+
class _WorkspaceFullDocumentDiagnosticReport(Model):
2285+
uri: DocumentUri
2286+
version: Optional[int]
2287+
2288+
2289+
@dataclass(repr=False)
2290+
class WorkspaceFullDocumentDiagnosticReport(FullDocumentDiagnosticReport, _WorkspaceFullDocumentDiagnosticReport):
2291+
pass
2292+
2293+
2294+
@dataclass(repr=False)
2295+
class _WorkspaceUnchangedDocumentDiagnosticReport(Model):
2296+
uri: DocumentUri
2297+
version: Optional[int]
2298+
2299+
2300+
@dataclass(repr=False)
2301+
class WorkspaceUnchangedDocumentDiagnosticReport(
2302+
UnchangedDocumentDiagnosticReport, _WorkspaceUnchangedDocumentDiagnosticReport
2303+
):
2304+
pass
2305+
2306+
2307+
WorkspaceDocumentDiagnosticReport = Union[
2308+
WorkspaceFullDocumentDiagnosticReport, WorkspaceUnchangedDocumentDiagnosticReport
2309+
]
2310+
2311+
2312+
@dataclass(repr=False)
2313+
class WorkspaceDiagnosticReportPartialResult(Model):
2314+
items: List[WorkspaceDocumentDiagnosticReport]
2315+
2316+
2317+
@dataclass(repr=False)
2318+
class WorkspaceDiagnosticReport(Model):
2319+
items: List[WorkspaceDocumentDiagnosticReport]

robotcode/utils/dataclasses.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# pyright: reportMissingTypeArgument=true, reportMissingParameterType=true
22
import dataclasses
33
import enum
4+
import functools
45
import inspect
56
import json
67
import re
@@ -32,6 +33,7 @@
3233
_RE_SNAKE_CASE_2 = re.compile(r"[A-Z]")
3334

3435

36+
@functools.lru_cache(1024)
3537
def to_snake_case(s: str) -> str:
3638

3739
s = _RE_SNAKE_CASE_1.sub("_", s)
@@ -44,6 +46,7 @@ def to_snake_case(s: str) -> str:
4446
_RE_CAMEL_CASE_2 = re.compile(r"[\-_\.\s]([a-z])")
4547

4648

49+
@functools.lru_cache(1024)
4750
def to_camel_case(s: str) -> str:
4851
s = _RE_CAMEL_CASE_1.sub("", str(s))
4952
if not s:

0 commit comments

Comments
 (0)