instruction stringclasses 100
values | code stringlengths 78 193k | response stringlengths 259 170k | file stringlengths 59 203 |
|---|---|---|---|
Add docstrings to make code maintainable | from __future__ import annotations
import logging
import os
from typing import TYPE_CHECKING, List
from mkdocs import utils
from mkdocs.config import base
from mkdocs.config import config_options as c
from mkdocs.contrib.search.search_index import SearchIndex
from mkdocs.plugins import BasePlugin
if TYPE_CHECKING:
... | --- +++ @@ -21,6 +21,7 @@
class LangOption(c.OptionallyRequired[List[str]]):
+ """Validate Language(s) provided in config are known languages."""
def get_lunr_supported_lang(self, lang):
fallback = {'uk': 'ru'}
@@ -59,8 +60,10 @@
class SearchPlugin(BasePlugin[_PluginConfig]):
+ """Add a se... | https://raw.githubusercontent.com/mkdocs/mkdocs/HEAD/mkdocs/contrib/search/__init__.py |
Add docstrings to existing functions | from __future__ import annotations
import enum
import fnmatch
import logging
import os
import posixpath
import shutil
import warnings
from functools import cached_property
from pathlib import PurePath, PurePosixPath
from typing import TYPE_CHECKING, Callable, Iterable, Iterator, Mapping, Sequence, overload
from urllib... | --- +++ @@ -60,31 +60,42 @@
class Files:
+ """A collection of [File][mkdocs.structure.files.File] objects."""
def __init__(self, files: Iterable[File]) -> None:
self._src_uris = {f.src_uri: f for f in files}
def __iter__(self) -> Iterator[File]:
+ """Iterate over the files within.""... | https://raw.githubusercontent.com/mkdocs/mkdocs/HEAD/mkdocs/structure/files.py |
Add concise docstrings to each method | from __future__ import annotations
import functools
import logging
import os
import sys
import warnings
from collections import UserDict
from contextlib import contextmanager
from typing import (
IO,
TYPE_CHECKING,
Any,
Generic,
Iterator,
List,
Mapping,
Sequence,
Tuple,
TypeVar,... | --- +++ @@ -58,11 +58,27 @@ self.warnings = []
def pre_validation(self, config: Config, key_name: str) -> None:
+ """
+ Before all options are validated, perform a pre-validation process.
+
+ The pre-validation process method should be implemented by subclasses.
+ """
d... | https://raw.githubusercontent.com/mkdocs/mkdocs/HEAD/mkdocs/config/base.py |
Add documentation for all methods |
import logging
import os
import pathlib
import re
import shutil
import stat
import subprocess
from overrides import override
from solidlsp.ls import LanguageServerDependencyProvider, LanguageServerDependencyProviderSinglePath, SolidLanguageServer
from solidlsp.ls_config import Language, LanguageServerConfig
from sol... | --- +++ @@ -1,3 +1,6 @@+"""
+Provides PHP specific instantiation of the LanguageServer class using Phpactor.
+"""
import logging
import os
@@ -22,6 +25,15 @@
class PhpactorServer(SolidLanguageServer):
+ """
+ Provides PHP specific instantiation of the LanguageServer class using Phpactor.
+
+ Phpactor i... | https://raw.githubusercontent.com/oraios/serena/HEAD/src/solidlsp/language_servers/phpactor.py |
Provide docstrings following PEP 257 | import json
from serena.config.serena_config import LanguageBackend
from serena.jetbrains.jetbrains_plugin_client import JetBrainsPluginClientManager
from serena.project_server import ProjectServerClient
from serena.tools import Tool, ToolMarkerDoesNotRequireActiveProject, ToolMarkerOptional
class ListQueryableProje... | --- +++ @@ -7,8 +7,16 @@
class ListQueryableProjectsTool(Tool, ToolMarkerOptional, ToolMarkerDoesNotRequireActiveProject):
+ """
+ Tool for listing all projects that can be queried by the QueryProjectTool.
+ """
def apply(self, symbol_access: bool = True) -> str:
+ """
+ Lists availabl... | https://raw.githubusercontent.com/oraios/serena/HEAD/src/serena/tools/query_project_tools.py |
Fill in missing docstrings in my code | # -*- coding: utf-8 -*-
import glob
import os
import shutil
from subprocess import Popen, PIPE
import re
import sys
from typing import List, Optional, Sequence
import platform
def popen(cmd):
shell = platform.system() != "Windows"
p = Popen(cmd, shell=shell, stdin=PIPE, stdout=PIPE)
return p
def call(cm... | --- +++ @@ -21,6 +21,12 @@
def execute(cmd, exceptionOnError=True):
+ """
+ :param cmd: the command to execute
+ :param exceptionOnError: if True, raise on exception on error (return code not 0); if False return
+ whether the call was successful
+ :return: True if the call was successful, False o... | https://raw.githubusercontent.com/oraios/serena/HEAD/repo_dir_sync.py |
Create documentation for each function signature | from __future__ import annotations
import logging
import threading
from abc import ABC, abstractmethod
from collections import defaultdict
from copy import copy
from dataclasses import asdict, dataclass
from enum import Enum
from anthropic.types import MessageParam, MessageTokensCount
from dotenv import load_dotenv
... | --- +++ @@ -17,11 +17,23 @@ class TokenCountEstimator(ABC):
@abstractmethod
def estimate_token_count(self, text: str) -> int:
+ """
+ Estimate the number of tokens in the given text.
+ This is an abstract method that should be implemented by subclasses.
+ """
class TiktokenCou... | https://raw.githubusercontent.com/oraios/serena/HEAD/src/serena/analytics.py |
Create Google-style docstrings for my code |
import logging
import os
import pathlib
import shutil
import threading
from overrides import override
from sensai.util.logging import LogTime
from solidlsp.ls import SolidLanguageServer
from solidlsp.ls_config import LanguageServerConfig
from solidlsp.lsp_protocol_handler.lsp_types import InitializeParams
from solid... | --- +++ @@ -1,3 +1,6 @@+"""
+Provides Elm specific instantiation of the LanguageServer class. Contains various configurations and settings specific to Elm.
+"""
import logging
import os
@@ -20,8 +23,14 @@
class ElmLanguageServer(SolidLanguageServer):
+ """
+ Provides Elm specific instantiation of the Lang... | https://raw.githubusercontent.com/oraios/serena/HEAD/src/solidlsp/language_servers/elm_language_server.py |
Generate missing documentation strings | from serena.tools import Tool, ToolMarkerDoesNotRequireActiveProject, ToolMarkerOptional
class OpenDashboardTool(Tool, ToolMarkerOptional, ToolMarkerDoesNotRequireActiveProject):
def apply(self) -> str:
if self.agent.open_dashboard():
return f"Serena web dashboard has been opened in the user'... | --- +++ @@ -2,8 +2,15 @@
class OpenDashboardTool(Tool, ToolMarkerOptional, ToolMarkerDoesNotRequireActiveProject):
+ """
+ Opens the Serena web dashboard in the default web browser.
+ The dashboard provides logs, session information, and tool usage statistics.
+ """
def apply(self) -> str:
+ ... | https://raw.githubusercontent.com/oraios/serena/HEAD/src/serena/tools/config_tools.py |
Add docstrings to meet PEP guidelines |
import logging
import os
import pathlib
import threading
from typing import Any, cast
from solidlsp.ls import (
LanguageServerDependencyProvider,
LanguageServerDependencyProviderSinglePath,
SolidLanguageServer,
)
from solidlsp.ls_config import LanguageServerConfig
from solidlsp.lsp_protocol_handler.lsp_ty... | --- +++ @@ -1,3 +1,32 @@+"""
+This is an alternative to clangd for large C++ codebases where ccls may perform
+better for indexing and navigation. Requires ccls to be installed and available
+on PATH, or configured via ls_specific_settings with key "ls_path".
+
+Installation
+------------
+ccls must be installed manual... | https://raw.githubusercontent.com/oraios/serena/HEAD/src/solidlsp/language_servers/ccls_language_server.py |
Add docstrings that explain logic | from typing import Literal
from serena.tools import Tool, ToolMarkerCanEdit
class WriteMemoryTool(Tool, ToolMarkerCanEdit):
def apply(self, memory_name: str, content: str, max_chars: int = -1) -> str:
# NOTE: utf-8 encoding is configured in the MemoriesManager
if max_chars == -1:
max... | --- +++ @@ -4,8 +4,21 @@
class WriteMemoryTool(Tool, ToolMarkerCanEdit):
+ """
+ Write some information (utf-8-encoded) about this project that can be useful for future tasks to a memory in md format.
+ The memory name should be meaningful.
+ """
def apply(self, memory_name: str, content: str, ma... | https://raw.githubusercontent.com/oraios/serena/HEAD/src/serena/tools/memory_tools.py |
Create docstrings for API functions |
import logging
import os
import pathlib
import shutil
import time
from typing import Any
from overrides import override
from solidlsp.ls import SolidLanguageServer
from solidlsp.ls_config import LanguageServerConfig
from solidlsp.lsp_protocol_handler.lsp_types import InitializeParams
from solidlsp.lsp_protocol_handl... | --- +++ @@ -1,3 +1,6 @@+"""
+Provides Haskell specific instantiation of the LanguageServer class. Contains various configurations and settings specific to Haskell.
+"""
import logging
import os
@@ -18,9 +21,14 @@
class HaskellLanguageServer(SolidLanguageServer):
+ """
+ Provides Haskell specific instantia... | https://raw.githubusercontent.com/oraios/serena/HEAD/src/solidlsp/language_servers/haskell_language_server.py |
Generate docstrings for each module | import logging
import os
import pathlib
import subprocess
from typing import Any, cast
from overrides import override
from solidlsp.ls import SolidLanguageServer
from solidlsp.ls_config import LanguageServerConfig
from solidlsp.lsp_protocol_handler.lsp_types import InitializeParams
from solidlsp.lsp_protocol_handler.... | --- +++ @@ -16,6 +16,9 @@
class Gopls(SolidLanguageServer):
+ """
+ Provides Go specific instantiation of the LanguageServer class using gopls.
+ """
@override
def is_ignored_dirname(self, dirname: str) -> bool:
@@ -27,6 +30,7 @@
@staticmethod
def _determine_log_level(line: str) -> i... | https://raw.githubusercontent.com/oraios/serena/HEAD/src/solidlsp/language_servers/gopls.py |
Create docstrings for API functions | import collections
import glob
import json
import os
import shutil
import subprocess
import sys
from collections.abc import Iterator, Sequence
from logging import Logger
from pathlib import Path
from typing import Any, Literal
import click
from sensai.util import logging
from sensai.util.logging import FileLoggerConte... | --- +++ @@ -57,10 +57,19 @@
def find_project_root(root: str | Path | None = None) -> str | None:
+ """Find project root by walking up from CWD.
+
+ Checks for .serena/project.yml first (explicit Serena project), then .git (git root).
+
+ :param root: If provided, constrains the search to this directory and... | https://raw.githubusercontent.com/oraios/serena/HEAD/src/serena/cli.py |
Generate missing documentation strings | import logging
import os
from collections.abc import Sequence
from enum import Enum
from typing import Any
from ruamel.yaml import YAML, CommentToken, StreamMark
from ruamel.yaml.comments import CommentedMap
from serena.constants import SERENA_FILE_ENCODING
log = logging.getLogger(__name__)
def _create_yaml(preser... | --- +++ @@ -13,6 +13,9 @@
def _create_yaml(preserve_comments: bool = False) -> YAML:
+ """
+ Creates a YAML that can load/save with comments if preserve_comments is True.
+ """
typ = None if preserve_comments else "safe"
result = YAML(typ=typ)
result.preserve_quotes = preserve_comments
@@ -2... | https://raw.githubusercontent.com/oraios/serena/HEAD/src/serena/util/yaml.py |
Add structured docstrings to improve clarity | import json
import logging
import os
from abc import ABC, abstractmethod
from collections.abc import Callable, Iterable, Iterator, Sequence
from dataclasses import asdict, dataclass
from time import perf_counter
from typing import Any, Generic, Literal, NotRequired, Self, TypedDict, TypeVar
from sensai.util.string imp... | --- +++ @@ -24,6 +24,9 @@
@dataclass
class LanguageServerSymbolLocation:
+ """
+ Represents the (start) location of a symbol identifier, which, within Serena, uniquely identifies the symbol.
+ """
relative_path: str | None
"""
@@ -56,6 +59,9 @@
@dataclass
class PositionInFile:
+ """
+ R... | https://raw.githubusercontent.com/oraios/serena/HEAD/src/serena/symbol.py |
Generate NumPy-style docstrings | import json
import logging
import os
import pathlib
import threading
from typing import Any, cast
from solidlsp.ls import LanguageServerDependencyProvider, LanguageServerDependencyProviderSinglePath, ProcessLaunchInfo, SolidLanguageServer
from solidlsp.ls_config import LanguageServerConfig
from solidlsp.lsp_protocol_h... | --- +++ @@ -16,8 +16,16 @@
class ClangdLanguageServer(SolidLanguageServer):
+ """
+ Provides C/C++ specific instantiation of the LanguageServer class. Contains various configurations and settings specific to C/C++.
+ As the project gets bigger in size, building index will take time. Try running clangd mult... | https://raw.githubusercontent.com/oraios/serena/HEAD/src/solidlsp/language_servers/clangd_language_server.py |
Generate docstrings for exported functions |
import concurrent
import json
import logging
import re
import threading
from concurrent.futures.thread import ThreadPoolExecutor
from dataclasses import dataclass
from pathlib import Path
from typing import Any, Literal, Optional, Self, TypeVar, cast
import requests
from requests import Response
from sensai.util.stri... | --- +++ @@ -1,3 +1,6 @@+"""
+Client for the Serena JetBrains Plugin
+"""
import concurrent
import json
@@ -26,12 +29,15 @@
class SerenaClientError(Exception):
+ """Base exception for Serena client errors."""
class ConnectionError(SerenaClientError):
+ """Raised when connection to the service fails.""... | https://raw.githubusercontent.com/oraios/serena/HEAD/src/serena/jetbrains/jetbrains_plugin_client.py |
Provide clean and structured docstrings |
import logging
import os
import pathlib
import shutil
import threading
from solidlsp.language_servers.common import RuntimeDependency, RuntimeDependencyCollection
from solidlsp.ls import (
DocumentSymbols,
LanguageServerDependencyProvider,
LanguageServerDependencyProviderSinglePath,
LSPFileBuffer,
... | --- +++ @@ -1,3 +1,7 @@+"""
+Provides Bash specific instantiation of the LanguageServer class using bash-language-server.
+Contains various configurations and settings specific to Bash scripting.
+"""
import logging
import os
@@ -21,8 +25,16 @@
class BashLanguageServer(SolidLanguageServer):
+ """
+ Provid... | https://raw.githubusercontent.com/oraios/serena/HEAD/src/solidlsp/language_servers/bash_language_server.py |
Add well-formatted docstrings | import logging
from typing import Any, Literal
import serena.jetbrains.jetbrains_types as jb
from serena.jetbrains.jetbrains_plugin_client import JetBrainsPluginClient
from serena.symbol import JetBrainsSymbolDictGrouper
from serena.tools import Tool, ToolMarkerOptional, ToolMarkerSymbolicRead
log = logging.getLogger... | --- +++ @@ -10,6 +10,9 @@
class JetBrainsFindSymbolTool(Tool, ToolMarkerSymbolicRead, ToolMarkerOptional):
+ """
+ Performs a global (or local) search for symbols using the JetBrains backend
+ """
def apply(
self,
@@ -21,6 +24,43 @@ search_deps: bool = False,
max_answer_cha... | https://raw.githubusercontent.com/oraios/serena/HEAD/src/serena/tools/jetbrains_tools.py |
Auto-generate documentation strings for this file |
import os
from collections.abc import Sequence
from serena.symbol import LanguageServerSymbol, LanguageServerSymbolDictGrouper
from serena.tools import (
SUCCESS_RESULT,
Tool,
ToolMarkerSymbolicEdit,
ToolMarkerSymbolicRead,
)
from serena.tools.tools_base import ToolMarkerOptional
from solidlsp.ls_type... | --- +++ @@ -1,3 +1,6 @@+"""
+Language server-related tools
+"""
import os
from collections.abc import Sequence
@@ -14,23 +17,48 @@
class RestartLanguageServerTool(Tool, ToolMarkerOptional):
+ """Restarts the language server, may be necessary when edits not through Serena happen."""
def apply(self) -> ... | https://raw.githubusercontent.com/oraios/serena/HEAD/src/serena/tools/symbol_tools.py |
Add docstrings for internal functions | # mypy: ignore-errors
import logging
import os
import queue
import sys
import threading
import tkinter as tk
import traceback
from enum import Enum, auto
from pathlib import Path
from typing import Literal
from serena import constants
from serena.util.logging import MemoryLogHandler
log = logging.getLogger(__name__)
... | --- +++ @@ -1,342 +1,417 @@-# mypy: ignore-errors
-import logging
-import os
-import queue
-import sys
-import threading
-import tkinter as tk
-import traceback
-from enum import Enum, auto
-from pathlib import Path
-from typing import Literal
-
-from serena import constants
-from serena.util.logging import MemoryLogHa... | https://raw.githubusercontent.com/oraios/serena/HEAD/src/serena/gui_log_viewer.py |
Generate helpful docstrings for debugging | import logging
import os
from collections.abc import Callable, Iterator
from dataclasses import dataclass, field
from pathlib import Path
from typing import NamedTuple
import pathspec
from pathspec import PathSpec
from sensai.util.logging import LogTime
log = logging.getLogger(__name__)
class ScanResult(NamedTuple)... | --- +++ @@ -1,281 +1,355 @@-import logging
-import os
-from collections.abc import Callable, Iterator
-from dataclasses import dataclass, field
-from pathlib import Path
-from typing import NamedTuple
-
-import pathspec
-from pathspec import PathSpec
-from sensai.util.logging import LogTime
-
-log = logging.getLogger(_... | https://raw.githubusercontent.com/oraios/serena/HEAD/src/serena/util/file_system.py |
Fill in missing docstrings in my code |
import logging
import os
import pathlib
import threading
from typing import cast
from overrides import override
from solidlsp.ls import SolidLanguageServer
from solidlsp.ls_config import LanguageServerConfig
from solidlsp.lsp_protocol_handler.lsp_types import InitializeParams
from solidlsp.lsp_protocol_handler.serve... | --- +++ @@ -1,3 +1,6 @@+"""
+Provides Python specific instantiation of the LanguageServer class. Contains various configurations and settings specific to Python.
+"""
import logging
import os
@@ -17,8 +20,14 @@
class JediServer(SolidLanguageServer):
+ """
+ Provides Python specific instantiation of the La... | https://raw.githubusercontent.com/oraios/serena/HEAD/src/solidlsp/language_servers/jedi_server.py |
Add docstrings to existing functions | import json
import logging
import os
from abc import ABC, abstractmethod
from collections.abc import Iterable, Iterator, Reversible
from contextlib import contextmanager
from typing import Generic, TypeVar, cast
from serena.jetbrains.jetbrains_plugin_client import JetBrainsPluginClient
from serena.symbol import JetBra... | --- +++ @@ -30,9 +30,17 @@
@abstractmethod
def get_contents(self) -> str:
+ """
+ :return: the contents of the file.
+ """
@abstractmethod
def set_contents(self, contents: str) -> None:
+ """
+ Fully resets the contents of the... | https://raw.githubusercontent.com/oraios/serena/HEAD/src/serena/code_editor.py |
Add docstrings to improve collaboration | import inspect
import json
from abc import ABC
from collections.abc import Iterable
from dataclasses import dataclass
from types import TracebackType
from typing import TYPE_CHECKING, Any, Protocol, Self, TypeVar, cast
from mcp import Implementation
from mcp.server.fastmcp import Context
from mcp.server.fastmcp.utilit... | --- +++ @@ -34,6 +34,9 @@ self.agent = agent
def get_project_root(self) -> str:
+ """
+ :return: the root directory of the active project, raises a ValueError if no active project configuration is set
+ """
return self.project.project_root
@property
@@ -67,9 +70,15 @@... | https://raw.githubusercontent.com/oraios/serena/HEAD/src/serena/tools/tools_base.py |
Generate docstrings for each module |
import logging
import os
import pathlib
import stat
import threading
from typing import cast
from overrides import override
from solidlsp.ls import (
LanguageServerDependencyProvider,
LanguageServerDependencyProviderSinglePath,
SolidLanguageServer,
)
from solidlsp.ls_config import LanguageServerConfig
fr... | --- +++ @@ -1,3 +1,20 @@+"""
+Provides Kotlin specific instantiation of the LanguageServer class. Contains various configurations and settings specific to Kotlin.
+
+You can configure the following options in ls_specific_settings (in serena_config.yml):
+
+ ls_specific_settings:
+ kotlin:
+ ls_path: '/pa... | https://raw.githubusercontent.com/oraios/serena/HEAD/src/solidlsp/language_servers/kotlin_language_server.py |
Add docstrings to clarify complex logic |
import logging
import os
import pathlib
import shutil
import subprocess
import threading
from typing import cast
from solidlsp.ls import LanguageServerDependencyProvider, LanguageServerDependencyProviderSinglePath, SolidLanguageServer
from solidlsp.ls_config import LanguageServerConfig
from solidlsp.lsp_protocol_hand... | --- +++ @@ -1,3 +1,6 @@+"""
+Provides Clojure specific instantiation of the LanguageServer class. Contains various configurations and settings specific to Clojure.
+"""
import logging
import os
@@ -38,6 +41,9 @@
class ClojureLSP(SolidLanguageServer):
+ """
+ Provides a clojure-lsp specific instantiation o... | https://raw.githubusercontent.com/oraios/serena/HEAD/src/solidlsp/language_servers/clojure_lsp.py |
Write docstrings for utility functions |
import logging
import os
import pathlib
from collections.abc import Hashable
from overrides import override
from solidlsp.ls import (
DocumentSymbols,
LanguageServerDependencyProvider,
LanguageServerDependencyProviderSinglePath,
LSPFileBuffer,
SolidLanguageServer,
)
from solidlsp.ls_config import... | --- +++ @@ -1,3 +1,7 @@+"""
+Provides Markdown specific instantiation of the LanguageServer class using marksman.
+Contains various configurations and settings specific to Markdown.
+"""
import logging
import os
@@ -24,6 +28,9 @@
class Marksman(SolidLanguageServer):
+ """
+ Provides Markdown specific inst... | https://raw.githubusercontent.com/oraios/serena/HEAD/src/solidlsp/language_servers/marksman.py |
Add docstrings to improve collaboration | import logging
import os
import pathlib
from typing import cast
from solidlsp.ls import SolidLanguageServer
from solidlsp.lsp_protocol_handler.server import ProcessLaunchInfo
from solidlsp.settings import SolidLSPSettings
from ..ls_config import LanguageServerConfig
from ..lsp_protocol_handler.lsp_types import Initia... | --- +++ @@ -15,8 +15,14 @@
class DartLanguageServer(SolidLanguageServer):
+ """
+ Provides Dart specific instantiation of the LanguageServer class. Contains various configurations and settings specific to Dart.
+ """
def __init__(self, config: LanguageServerConfig, repository_root_path: str, solidls... | https://raw.githubusercontent.com/oraios/serena/HEAD/src/solidlsp/language_servers/dart_language_server.py |
Improve documentation using docstrings |
import sys
from collections.abc import AsyncIterator, Iterator, Sequence
from contextlib import asynccontextmanager
from copy import deepcopy
from dataclasses import dataclass
from typing import Any, Literal, cast
import docstring_parser
from mcp.server.fastmcp import server
from mcp.server.fastmcp.server import Fast... | --- +++ @@ -1,3 +1,6 @@+"""
+The Serena Model Context Protocol (MCP) Server
+"""
import sys
from collections.abc import AsyncIterator, Iterator, Sequence
@@ -45,8 +48,18 @@
class SerenaMCPFactory:
+ """
+ Factory for the creation of the Serena MCP server with an associated SerenaAgent.
+ """
def... | https://raw.githubusercontent.com/oraios/serena/HEAD/src/serena/mcp.py |
Improve my code by adding docstrings |
import logging
import os
import pathlib
import subprocess
import time
from typing import Any
from overrides import override
from solidlsp.ls import SolidLanguageServer
from solidlsp.ls_config import LanguageServerConfig
from solidlsp.ls_utils import PlatformId, PlatformUtils
from solidlsp.lsp_protocol_handler.lsp_ty... | --- +++ @@ -1,3 +1,8 @@+"""
+Provides Perl specific instantiation of the LanguageServer class using Perl::LanguageServer.
+
+Note: Windows is not supported as Nix itself doesn't support Windows natively.
+"""
import logging
import os
@@ -19,9 +24,13 @@
class PerlLanguageServer(SolidLanguageServer):
+ """
+ ... | https://raw.githubusercontent.com/oraios/serena/HEAD/src/solidlsp/language_servers/perl_language_server.py |
Add clean documentation to messy code |
import logging
import os
import shutil
import subprocess
import threading
import time
from overrides import override
from solidlsp.ls import SolidLanguageServer
from solidlsp.ls_config import LanguageServerConfig
from solidlsp.lsp_protocol_handler.server import ProcessLaunchInfo
from solidlsp.settings import SolidLS... | --- +++ @@ -1,3 +1,4 @@+"""Erlang Language Server implementation using Erlang LS."""
import logging
import os
@@ -17,8 +18,13 @@
class ErlangLanguageServer(SolidLanguageServer):
+ """Language server for Erlang using Erlang LS."""
def __init__(self, config: LanguageServerConfig, repository_root_path: s... | https://raw.githubusercontent.com/oraios/serena/HEAD/src/solidlsp/language_servers/erlang_language_server.py |
Document functions with detailed explanations |
import json
import logging
import os
import pathlib
import threading
from collections.abc import Iterable
from overrides import override
from solidlsp.ls import SolidLanguageServer
from solidlsp.ls_config import LanguageServerConfig
from solidlsp.ls_exceptions import SolidLSPException
from solidlsp.ls_utils import D... | --- +++ @@ -1,3 +1,6 @@+"""
+Provides C# specific instantiation of the LanguageServer class. Contains various configurations and settings specific to C#.
+"""
import json
import logging
@@ -20,6 +23,10 @@
def breadth_first_file_scan(root: str) -> Iterable[str]:
+ """
+ This function was obtained from http... | https://raw.githubusercontent.com/oraios/serena/HEAD/src/solidlsp/language_servers/omnisharp.py |
Add docstrings that explain purpose and usage |
import logging
import os
import pathlib
import shutil
from time import sleep
from overrides import override
from solidlsp.ls import LanguageServerDependencyProvider, LanguageServerDependencyProviderSinglePath, SolidLanguageServer
from solidlsp.ls_config import LanguageServerConfig
from solidlsp.ls_utils import Platf... | --- +++ @@ -1,3 +1,6 @@+"""
+Provides PHP specific instantiation of the LanguageServer class using Intelephense.
+"""
import logging
import os
@@ -20,6 +23,14 @@
class Intelephense(SolidLanguageServer):
+ """
+ Provides PHP specific instantiation of the LanguageServer class using Intelephense.
+
+ You ... | https://raw.githubusercontent.com/oraios/serena/HEAD/src/solidlsp/language_servers/intelephense.py |
Write docstrings for data processing functions | # type: ignore
import logging
import os
import pathlib
import platform
import shutil
import subprocess
from pathlib import Path
from overrides import override
from solidlsp import ls_types
from solidlsp.ls import DocumentSymbols, LSPFileBuffer, SolidLanguageServer
from solidlsp.ls_config import LanguageServerConfig
... | --- +++ @@ -1,4 +1,9 @@ # type: ignore
+"""
+Provides Nix specific instantiation of the LanguageServer class using nixd (Nix Language Server).
+
+Note: Windows is not supported as Nix itself doesn't support Windows natively.
+"""
import logging
import os
@@ -21,10 +26,19 @@
class NixLanguageServer(SolidLanguage... | https://raw.githubusercontent.com/oraios/serena/HEAD/src/solidlsp/language_servers/nixd_ls.py |
Annotate my code with docstrings | import logging
import os
from typing import Any
from .multilang_prompt import DEFAULT_LANG_CODE, LanguageFallbackMode, MultiLangPromptCollection, PromptList
log = logging.getLogger(__name__)
class PromptFactoryBase:
def __init__(self, prompts_dir: str | list[str], lang_code: str = DEFAULT_LANG_CODE, fallback_m... | --- +++ @@ -8,8 +8,18 @@
class PromptFactoryBase:
+ """Base class for auto-generated prompt factory classes."""
def __init__(self, prompts_dir: str | list[str], lang_code: str = DEFAULT_LANG_CODE, fallback_mode=LanguageFallbackMode.EXCEPTION):
+ """
+ :param prompts_dir: the directory contai... | https://raw.githubusercontent.com/oraios/serena/HEAD/src/interprompt/prompt_factory.py |
Add docstrings that explain purpose and usage |
import os.path
from serena.tools import Tool, ToolMarkerCanEdit
from serena.util.shell import execute_shell_command
class ExecuteShellCommandTool(Tool, ToolMarkerCanEdit):
def apply(
self,
command: str,
cwd: str | None = None,
capture_stderr: bool = True,
max_answer_char... | --- +++ @@ -1,3 +1,6 @@+"""
+Tools supporting the execution of (external) commands
+"""
import os.path
@@ -6,6 +9,9 @@
class ExecuteShellCommandTool(Tool, ToolMarkerCanEdit):
+ """
+ Executes a shell command.
+ """
def apply(
self,
@@ -14,6 +20,21 @@ capture_stderr: bool = True... | https://raw.githubusercontent.com/oraios/serena/HEAD/src/serena/tools/cmd_tools.py |
Expand my code with proper documentation strings | import logging
import os
from collections.abc import Callable, Iterator
from typing import TypeVar
from serena.util.file_system import find_all_non_ignored_files
from solidlsp.ls_config import Language
T = TypeVar("T")
log = logging.getLogger(__name__)
def iter_subclasses(
cls: type[T], recursive: bool = True,... | --- +++ @@ -14,6 +14,12 @@ def iter_subclasses(
cls: type[T], recursive: bool = True, inclusion_predicate: Callable[[type[T]], bool] = lambda t: True
) -> Iterator[type[T]]:
+ """Iterate over all subclasses of a class.
+
+ :param cls: The class whose subclasses to iterate over.
+ :param recursive: If Tru... | https://raw.githubusercontent.com/oraios/serena/HEAD/src/serena/util/inspection.py |
Annotate my code with docstrings |
import logging
import os
import pathlib
import platform
import re
import stat
import time
import zipfile
from pathlib import Path
import requests
from overrides import override
from solidlsp import ls_types
from solidlsp.language_servers.common import quote_windows_path
from solidlsp.ls import DocumentSymbols, LSPFi... | --- +++ @@ -1,3 +1,4 @@+"""AL Language Server implementation for Microsoft Dynamics 365 Business Central."""
import logging
import os
@@ -25,6 +26,19 @@
class ALLanguageServer(SolidLanguageServer):
+ """
+ Language server implementation for AL (Microsoft Dynamics 365 Business Central).
+
+ This impleme... | https://raw.githubusercontent.com/oraios/serena/HEAD/src/solidlsp/language_servers/al_language_server.py |
Generate docstrings for this script | import os
import sys
from serena.agent import log
def is_headless_environment() -> bool:
# Check if we're on Windows - GUI usually works there
if sys.platform == "win32":
return False
# Check for DISPLAY variable (required for X11)
if not os.environ.get("DISPLAY"): # type: ignore
re... | --- +++ @@ -5,6 +5,15 @@
def is_headless_environment() -> bool:
+ """
+ Detect if we're running in a headless environment where GUI operations would fail.
+
+ Returns True if:
+ - No DISPLAY variable on Linux/Unix
+ - Running in SSH session
+ - Running in WSL without X server
+ - Running in Doc... | https://raw.githubusercontent.com/oraios/serena/HEAD/src/serena/util/exception.py |
Add docstrings with type hints explained |
import logging
import os
import pathlib
import shutil
import subprocess
from typing import cast
from overrides import override
from solidlsp.ls import LanguageServerDependencyProvider, LanguageServerDependencyProviderSinglePath, SolidLanguageServer
from solidlsp.ls_config import LanguageServerConfig
from solidlsp.ls... | --- +++ @@ -1,3 +1,7 @@+"""
+Provides Lean 4 specific instantiation of the LanguageServer class.
+Uses the built-in Lean 4 language server (lean --server).
+"""
import logging
import os
@@ -17,6 +21,11 @@
class Lean4LanguageServer(SolidLanguageServer):
+ """
+ Provides Lean 4 specific instantiation of the... | https://raw.githubusercontent.com/oraios/serena/HEAD/src/solidlsp/language_servers/lean4_language_server.py |
Document my Python code with docstrings | import queue
import threading
from collections.abc import Callable
from dataclasses import dataclass
from typing import Optional
from sensai.util import logging
from serena.constants import LOG_MESSAGES_BUFFER_SIZE, SERENA_LOG_FORMAT
lg = logging
@dataclass
class LogMessages:
messages: list[str]
"""
th... | --- +++ @@ -37,6 +37,10 @@ self.worker_thread.start()
def add_emit_callback(self, callback: Callable[[str], None]) -> None:
+ """
+ Adds a callback that will be called with each log message.
+ The callback should accept a single string argument (the log message).
+ """
... | https://raw.githubusercontent.com/oraios/serena/HEAD/src/serena/util/logging.py |
Create Google-style docstrings for my code |
import dataclasses
import os
import re
import shutil
from collections.abc import Iterator, Sequence
from copy import deepcopy
from dataclasses import dataclass, field
from datetime import UTC, datetime
from enum import Enum
from functools import cached_property
from pathlib import Path
from typing import TYPE_CHECKING... | --- +++ @@ -1,3 +1,6 @@+"""
+The Serena Model Context Protocol (MCP) Server
+"""
import dataclasses
import os
@@ -48,6 +51,9 @@
@singleton
class SerenaPaths:
+ """
+ Provides paths to various Serena-related directories and files.
+ """
def __init__(self) -> None:
home_dir = os.getenv("SE... | https://raw.githubusercontent.com/oraios/serena/HEAD/src/serena/config/serena_config.py |
Add docstrings for internal functions |
import dataclasses
import logging
import os
import pathlib
import shutil
import threading
import uuid
from pathlib import PurePath
from time import sleep
from typing import cast
from overrides import override
from solidlsp import ls_types
from solidlsp.ls import LanguageServerDependencyProvider, LSPFileBuffer, Solid... | --- +++ @@ -1,3 +1,6 @@+"""
+Provides Java specific instantiation of the LanguageServer class. Contains various configurations and settings specific to Java.
+"""
import dataclasses
import logging
@@ -25,6 +28,9 @@
@dataclasses.dataclass
class RuntimeDependencyPaths:
+ """
+ Stores the paths to the runtime... | https://raw.githubusercontent.com/oraios/serena/HEAD/src/solidlsp/language_servers/eclipse_jdtls.py |
Can you add docstrings to this Python file? |
import glob
import logging
import os
import pathlib
import platform
import shutil
import threading
import zipfile
from typing import Any, cast
import requests
from solidlsp.ls import LanguageServerDependencyProvider, LSPFileBuffer, SolidLanguageServer
from solidlsp.ls_config import LanguageServerConfig
from solidlsp... | --- +++ @@ -1,3 +1,34 @@+"""
+MATLAB language server integration using the official MathWorks MATLAB Language Server.
+
+Architecture:
+ This module uses the MathWorks MATLAB VS Code extension (mathworks.language-matlab)
+ which contains a Node.js-based language server. The extension is downloaded from the
+ V... | https://raw.githubusercontent.com/oraios/serena/HEAD/src/solidlsp/language_servers/matlab_language_server.py |
Document this script properly |
import logging
import os
import pathlib
import platform
import re
import shutil
import stat
import subprocess
import threading
from typing import Any
from overrides import override
from solidlsp.ls import SolidLanguageServer
from solidlsp.ls_config import LanguageServerConfig
from solidlsp.lsp_protocol_handler.lsp_t... | --- +++ @@ -1,3 +1,7 @@+"""
+Provides OCaml and Reason specific instantiation of the SolidLanguageServer class.
+Contains various configurations and settings specific to OCaml and Reason.
+"""
import logging
import os
@@ -23,6 +27,10 @@
class OcamlLanguageServer(SolidLanguageServer):
+ """
+ Provides OCam... | https://raw.githubusercontent.com/oraios/serena/HEAD/src/solidlsp/language_servers/ocaml_lsp_server.py |
Create documentation strings for testing functions |
import os
import platform
import subprocess
import sys
from collections.abc import Callable, Iterator, Sequence
from contextlib import contextmanager
from logging import Logger
from typing import TYPE_CHECKING, Optional, TypeVar
from sensai.util import logging
from sensai.util.logging import LogTime
from sensai.util.... | --- +++ @@ -1,3 +1,6 @@+"""
+The Serena Model Context Protocol (MCP) Server
+"""
import os
import platform
@@ -50,8 +53,14 @@
class AvailableTools:
+ """
+ Represents the set of available/exposed tools of a SerenaAgent.
+ """
def __init__(self, tools: list[Tool]):
+ """
+ :param to... | https://raw.githubusercontent.com/oraios/serena/HEAD/src/serena/agent.py |
Write clean docstrings for readability | from __future__ import annotations
import logging
import os
import platform
import subprocess
from collections.abc import Iterable, Mapping, Sequence
from dataclasses import dataclass, replace
from typing import Any, cast
from solidlsp.ls_utils import FileUtils, PlatformUtils
from solidlsp.util.subprocess_util import... | --- +++ @@ -16,6 +16,7 @@
@dataclass(kw_only=True)
class RuntimeDependency:
+ """Represents a runtime dependency for a language server."""
id: str
platform_id: str | None = None
@@ -30,8 +31,15 @@
class RuntimeDependencyCollection:
+ """Utility to handle installation of runtime dependencies."""... | https://raw.githubusercontent.com/oraios/serena/HEAD/src/solidlsp/language_servers/common.py |
Can you add docstrings to this Python file? | import json
import logging
import os
import re
import shutil
import threading
from collections.abc import Sequence
from pathlib import Path
from typing import TYPE_CHECKING, Any, Literal, Optional
import pathspec
from sensai.util.logging import LogTime
from sensai.util.string import TextBuilder, ToStringMixin
from se... | --- +++ @@ -36,6 +36,10 @@ _global_memory_dir = SerenaPaths().global_memories_path
def __init__(self, serena_data_folder: str | Path | None, read_only_memory_patterns: Sequence[str] = ()):
+ """
+ :param serena_data_folder: the absolute path to the project's .serena data folder
+ :param ... | https://raw.githubusercontent.com/oraios/serena/HEAD/src/serena/project.py |
Write docstrings for algorithm functions |
import logging
import os
import pathlib
import platform
import shutil
import tarfile
import zipfile
from pathlib import Path
import requests
from overrides import override
from solidlsp.ls import SolidLanguageServer
from solidlsp.ls_config import LanguageServerConfig
from solidlsp.lsp_protocol_handler.lsp_types impo... | --- +++ @@ -1,3 +1,6 @@+"""
+Provides Lua specific instantiation of the LanguageServer class using lua-language-server.
+"""
import logging
import os
@@ -21,6 +24,9 @@
class LuaLanguageServer(SolidLanguageServer):
+ """
+ Provides Lua specific instantiation of the LanguageServer class using lua-language-s... | https://raw.githubusercontent.com/oraios/serena/HEAD/src/solidlsp/language_servers/lua_ls.py |
Add well-formatted docstrings |
from __future__ import annotations
import hashlib
import json
import logging
import os
import pathlib
import platform
import shutil
import tarfile
import threading
import time
import urllib.error
import urllib.request
import uuid
import zipfile
from solidlsp.language_servers.common import RuntimeDependency, RuntimeD... | --- +++ @@ -1,3 +1,44 @@+"""
+Provides Pascal/Free Pascal specific instantiation of the LanguageServer class using pasls.
+Contains various configurations and settings specific to Pascal and Free Pascal.
+
+pasls installation strategy:
+1. Use existing pasls from PATH
+2. Download prebuilt binary from GitHub releases (... | https://raw.githubusercontent.com/oraios/serena/HEAD/src/solidlsp/language_servers/pascal_server.py |
Add docstrings to improve collaboration | import concurrent.futures
import threading
import time
from collections.abc import Callable
from concurrent.futures import Future
from dataclasses import dataclass
from threading import Thread
from typing import Generic, TypeVar
from sensai.util import logging
from sensai.util.logging import LogTime
from sensai.util.s... | --- +++ @@ -27,6 +27,12 @@
class Task(ToStringMixin, Generic[T]):
def __init__(self, function: Callable[[], T], name: str, logged: bool = True, timeout: float | None = None):
+ """
+ :param function: the function representing the task to execute
+ :param name: the name of... | https://raw.githubusercontent.com/oraios/serena/HEAD/src/serena/task_executor.py |
Improve my code by adding docstrings | import fnmatch
import logging
import os
import re
from collections.abc import Callable
from dataclasses import dataclass, field
from enum import StrEnum
from typing import Any, Literal, Self
from bs4 import BeautifulSoup
from joblib import Parallel, delayed
from serena.constants import DEFAULT_SOURCE_FILE_ENCODING
l... | --- +++ @@ -16,6 +16,7 @@
class LineType(StrEnum):
+ """Enum for different types of lines in search results."""
MATCH = "match"
"""Part of the matched lines"""
@@ -27,6 +28,7 @@
@dataclass(kw_only=True)
class TextLine:
+ """Represents a line of text with information on how it relates to the mat... | https://raw.githubusercontent.com/oraios/serena/HEAD/src/serena/util/text_utils.py |
Generate missing documentation strings |
import logging
import os
import pathlib
import platform
import shutil
import threading
import zipfile
from pathlib import Path
import requests
from overrides import override
from solidlsp.ls import LanguageServerDependencyProvider, LanguageServerDependencyProviderSinglePath, SolidLanguageServer
from solidlsp.ls_conf... | --- +++ @@ -1,3 +1,21 @@+"""
+Provides Luau specific instantiation of the LanguageServer class using luau-lsp.
+
+Luau is the programming language used by Roblox, derived from Lua 5.1 with
+additional features like type annotations, string interpolation, and more.
+This uses JohnnyMorganz/luau-lsp as the language serve... | https://raw.githubusercontent.com/oraios/serena/HEAD/src/solidlsp/language_servers/luau_lsp.py |
Document functions with clear intent | from typing import Any
import jinja2
import jinja2.meta
import jinja2.nodes
import jinja2.visitor
from interprompt.util.class_decorators import singleton
class ParameterizedTemplateInterface:
def get_parameters(self) -> list[str]: ...
@singleton
class _JinjaEnvProvider:
def __init__(self) -> None:
... | --- +++ @@ -31,7 +31,13 @@ self._parameters = sorted(jinja2.meta.find_undeclared_variables(parsed_content))
def render(self, **params: Any) -> str:
+ """Renders the template with the given kwargs. You can find out which parameters are required by calling get_parameter_names()."""
return s... | https://raw.githubusercontent.com/oraios/serena/HEAD/src/interprompt/jinja_template.py |
Add docstrings to existing functions |
import fnmatch
import logging
import os
import pathlib
import shutil
from typing import Any, ClassVar
from overrides import override
from solidlsp.language_servers.common import RuntimeDependency, RuntimeDependencyCollection
from solidlsp.ls import LanguageServerDependencyProvider, LanguageServerDependencyProviderSi... | --- +++ @@ -1,3 +1,7 @@+"""
+Provides Ansible specific instantiation of the LanguageServer class using ansible-language-server.
+Contains various configurations and settings specific to Ansible YAML files (playbooks, roles, etc.).
+"""
import fnmatch
import logging
@@ -18,6 +22,7 @@
def _deep_merge(base: dict, ... | https://raw.githubusercontent.com/oraios/serena/HEAD/src/solidlsp/language_servers/ansible_language_server.py |
Help me add docstrings to my project | import logging
import os
from enum import Enum
from typing import Any, Generic, Literal, TypeVar
import yaml
from sensai.util.string import ToStringMixin
from .jinja_template import JinjaTemplate, ParameterizedTemplateInterface
log = logging.getLogger(__name__)
class PromptTemplate(ToStringMixin, ParameterizedTemp... | --- +++ @@ -42,6 +42,9 @@
class LanguageFallbackMode(Enum):
+ """
+ Defines what to do if there is no item for the given language.
+ """
ANY = "any"
"""
@@ -58,6 +61,10 @@
class _MultiLangContainer(Generic[T], ToStringMixin):
+ """
+ A container of items (usually, all having the same ... | https://raw.githubusercontent.com/oraios/serena/HEAD/src/interprompt/multilang_prompt.py |
Replace inline comments with docstrings | class Version:
def __init__(self, package_or_version: object | str):
if isinstance(package_or_version, str):
version_string = package_or_version
elif hasattr(package_or_version, "__version__"):
package_version_string = getattr(package_or_version, "__version__", None)
... | --- +++ @@ -1,6 +1,16 @@ class Version:
+ """
+ Represents a version, specifically the numeric components of a version string.
+
+ Suffixes like "rc1" or "-dev" are ignored, i.e. for a version string like "1.2.3rc1",
+ the components are [1, 2, 3].
+ """
def __init__(self, package_or_version: obje... | https://raw.githubusercontent.com/oraios/serena/HEAD/src/serena/util/version.py |
Add concise docstrings to each method | import logging
import os.path
import threading
from collections.abc import Iterator
from sensai.util.logging import LogTime
from serena.config.serena_config import SerenaPaths
from solidlsp import SolidLanguageServer
from solidlsp.ls_config import Language, LanguageServerConfig
from solidlsp.settings import SolidLSPS... | --- +++ @@ -59,12 +59,22 @@
class LanguageServerManager:
+ """
+ Manages one or more language servers for a project.
+ """
def __init__(
self,
language_servers: dict[Language, SolidLanguageServer],
language_server_factory: LanguageServerFactory | None = None,
) -> Non... | https://raw.githubusercontent.com/oraios/serena/HEAD/src/serena/ls_manager.py |
Generate docstrings for each module |
import os
from dataclasses import dataclass, field
from pathlib import Path
from typing import TYPE_CHECKING, Self
import yaml
from sensai.util import logging
from sensai.util.string import ToStringMixin
from serena.config.serena_config import SerenaPaths, ToolInclusionDefinition
from serena.constants import (
D... | --- +++ @@ -1,3 +1,6 @@+"""
+Context and Mode configuration loader
+"""
import os
from dataclasses import dataclass, field
@@ -25,6 +28,10 @@
@dataclass(kw_only=True)
class SerenaAgentMode(ToolInclusionDefinition, ToStringMixin):
+ """Represents a mode of operation for the agent, typically read off a YAML fil... | https://raw.githubusercontent.com/oraios/serena/HEAD/src/serena/config/context_mode.py |
Turn comments into proper docstrings | import json
import logging
from typing import TYPE_CHECKING
import requests as requests_lib
from flask import Flask, request
from pydantic import BaseModel
from sensai.util.logging import LogTime
from serena.config.serena_config import LanguageBackend, SerenaConfig
from serena.jetbrains.jetbrains_plugin_client import... | --- +++ @@ -20,6 +20,10 @@
class QueryProjectRequest(BaseModel):
+ """
+ Request model for the /query_project endpoint, matching the interface of
+ :class:`~serena.tools.query_project_tools.QueryProjectTool`.
+ """
project_name: str
tool_name: str
@@ -27,6 +31,16 @@
class ProjectServer:
... | https://raw.githubusercontent.com/oraios/serena/HEAD/src/serena/project_server.py |
Write docstrings for algorithm functions | import logging
import os
import pathlib
import stat
import subprocess
import threading
from typing import Any, cast
from overrides import override
from solidlsp.ls import SolidLanguageServer
from solidlsp.ls_config import LanguageServerConfig
from solidlsp.ls_utils import FileUtils, PlatformId, PlatformUtils
from sol... | --- +++ @@ -21,6 +21,9 @@
class ElixirTools(SolidLanguageServer):
+ """
+ Provides Elixir specific instantiation of the LanguageServer class using Expert, the official Elixir language server.
+ """
@override
def _get_wait_time_for_cross_file_referencing(self) -> float:
@@ -39,6 +42,7 @@
@... | https://raw.githubusercontent.com/oraios/serena/HEAD/src/solidlsp/language_servers/elixir_tools/elixir_tools.py |
Generate descriptive docstrings automatically |
import logging
import os
import pathlib
import shutil
from typing import Any, cast
import psutil
from overrides import override
from solidlsp.ls import LanguageServerDependencyProvider, LanguageServerDependencyProviderSinglePath, SolidLanguageServer
from solidlsp.ls_config import LanguageServerConfig
from solidlsp.l... | --- +++ @@ -1,3 +1,7 @@+"""
+Shader language server using shader-language-server (antaalt/shader-sense).
+Supports HLSL, GLSL, and WGSL shader file formats.
+"""
import logging
import os
@@ -23,6 +27,10 @@
class HlslLanguageServer(SolidLanguageServer):
+ """
+ Shader language server using shader-language-... | https://raw.githubusercontent.com/oraios/serena/HEAD/src/solidlsp/language_servers/hlsl_language_server.py |
Write docstrings describing each step |
import os
from collections import defaultdict
from fnmatch import fnmatch
from pathlib import Path
from typing import Literal
from serena.tools import SUCCESS_RESULT, EditedFileContext, Tool, ToolMarkerCanEdit, ToolMarkerOptional
from serena.util.file_system import scan_directory
from serena.util.text_utils import Co... | --- +++ @@ -1,3 +1,10 @@+"""
+File and file system-related tools, specifically for
+ * listing directory contents
+ * reading files
+ * creating files
+ * editing at the file level
+"""
import os
from collections import defaultdict
@@ -11,8 +18,23 @@
class ReadFileTool(Tool):
+ """
+ Reads a file with... | https://raw.githubusercontent.com/oraios/serena/HEAD/src/serena/tools/file_tools.py |
Turn comments into proper docstrings | import logging
import platform
import re
import shutil
import subprocess
import urllib
from pathlib import Path
from serena.util.version import Version
from solidlsp.ls_exceptions import SolidLSPException
log = logging.getLogger(__name__)
class DotNETUtil:
def __init__(self, required_version: str, allow_higher_... | --- +++ @@ -14,6 +14,10 @@
class DotNETUtil:
def __init__(self, required_version: str, allow_higher_version: bool = True):
+ """
+ :param required_version: the required .NET runtime version specified as a string (e.g. "10.0" for .NET 10.0)
+ :param allow_higher_version: whether to allow high... | https://raw.githubusercontent.com/oraios/serena/HEAD/src/serena/util/dotnet.py |
Write docstrings describing functionality |
import dataclasses
import logging
import os
import pathlib
import shlex
from solidlsp.ls import SolidLanguageServer
from solidlsp.ls_config import Language, LanguageServerConfig
from solidlsp.ls_utils import FileUtils, PlatformUtils
from solidlsp.lsp_protocol_handler.lsp_types import InitializeParams
from solidlsp.ls... | --- +++ @@ -1,3 +1,6 @@+"""
+Provides Groovy specific instantiation of the LanguageServer class. Contains various configurations and settings specific to Groovy.
+"""
import dataclasses
import logging
@@ -17,6 +20,9 @@
@dataclasses.dataclass
class GroovyRuntimeDependencyPaths:
+ """
+ Stores the paths to t... | https://raw.githubusercontent.com/oraios/serena/HEAD/src/solidlsp/language_servers/groovy_language_server.py |
Include argument descriptions in docstrings |
import logging
import os
import pathlib
import re
import shutil
from overrides import override
from solidlsp import ls_types
from solidlsp.ls import DocumentSymbols, LSPFileBuffer, SolidLanguageServer
from solidlsp.ls_config import LanguageServerConfig
from solidlsp.lsp_protocol_handler.lsp_types import InitializePa... | --- +++ @@ -1,3 +1,6 @@+"""
+Fortran Language Server implementation using fortls.
+"""
import logging
import os
@@ -18,6 +21,7 @@
class FortranLanguageServer(SolidLanguageServer):
+ """Fortran Language Server implementation using fortls."""
@override
def _get_wait_time_for_cross_file_referencing(... | https://raw.githubusercontent.com/oraios/serena/HEAD/src/solidlsp/language_servers/fortran_language_server.py |
Provide docstrings following PEP 257 |
import logging
import os
import platform
import shutil
import threading
import urllib.request
from collections.abc import Iterable
from pathlib import Path
from typing import Any, cast
from overrides import override
from serena.util.dotnet import DotNETUtil
from solidlsp.ls import DocumentSymbols, LanguageServerDepe... | --- +++ @@ -1,3 +1,6 @@+"""
+CSharp Language Server using Roslyn Language Server (Official Roslyn-based LSP server from NuGet.org)
+"""
import logging
import os
@@ -96,6 +99,10 @@
def breadth_first_file_scan(root_dir: str) -> Iterable[str]:
+ """
+ Perform a breadth-first scan of files in the given direct... | https://raw.githubusercontent.com/oraios/serena/HEAD/src/solidlsp/language_servers/csharp_language_server.py |
Write documentation strings for class attributes | import logging
import os
import pathlib
import platform
import shutil
import subprocess
from typing import Any
from overrides import override
from solidlsp.ls import SolidLanguageServer
from solidlsp.ls_config import LanguageServerConfig
from solidlsp.lsp_protocol_handler.lsp_types import InitializeParams
from solidl... | --- +++ @@ -18,6 +18,9 @@
class JuliaLanguageServer(SolidLanguageServer):
+ """
+ Language server implementation for Julia using LanguageServer.jl.
+ """
def __init__(self, config: LanguageServerConfig, repository_root_path: str, solidlsp_settings: SolidLSPSettings):
julia_executable = self... | https://raw.githubusercontent.com/oraios/serena/HEAD/src/solidlsp/language_servers/julia_server.py |
Add clean documentation to messy code |
import logging
import os
import pathlib
import shutil
import threading
from pathlib import Path
from overrides import override
from serena.util.dotnet import DotNETUtil
from solidlsp.language_servers.common import RuntimeDependency, RuntimeDependencyCollection
from solidlsp.ls import SolidLanguageServer
from solidls... | --- +++ @@ -1,3 +1,6 @@+"""
+Provides F# specific instantiation of the LanguageServer class.
+"""
import logging
import os
@@ -21,8 +24,16 @@
class FSharpLanguageServer(SolidLanguageServer):
+ """
+ Provides F# specific instantiation of the LanguageServer class using Ionide LSP (FsAutoComplete).
+ Cont... | https://raw.githubusercontent.com/oraios/serena/HEAD/src/solidlsp/language_servers/fsharp_language_server.py |
Turn comments into proper docstrings |
import platform
from serena.tools import Tool, ToolMarkerDoesNotRequireActiveProject, ToolMarkerOptional
class CheckOnboardingPerformedTool(Tool):
def apply(self) -> str:
project_memories = self.memories_manager.list_project_memories()
if len(project_memories) == 0:
msg = (
... | --- +++ @@ -1,3 +1,6 @@+"""
+Tools supporting the general workflow of the agent
+"""
import platform
@@ -5,8 +8,15 @@
class CheckOnboardingPerformedTool(Tool):
+ """
+ Checks whether project onboarding was already performed.
+ """
def apply(self) -> str:
+ """
+ Checks whether pro... | https://raw.githubusercontent.com/oraios/serena/HEAD/src/serena/tools/workflow_tools.py |
Add docstrings with type hints explained |
import logging
import os
import pathlib
import re
import sys
import threading
from typing import cast
from overrides import override
from solidlsp.ls import LanguageServerDependencyProvider, LanguageServerDependencyProviderSinglePath, SolidLanguageServer
from solidlsp.ls_config import LanguageServerConfig
from solid... | --- +++ @@ -1,3 +1,6 @@+"""
+Provides Python specific instantiation of the LanguageServer class. Contains various configurations and settings specific to Python.
+"""
import logging
import os
@@ -18,8 +21,16 @@
class PyrightServer(SolidLanguageServer):
+ """
+ Provides Python specific instantiation of the... | https://raw.githubusercontent.com/oraios/serena/HEAD/src/solidlsp/language_servers/pyright_server.py |
Add docstrings to meet PEP guidelines |
import logging
import os
import pathlib
import platform
import shutil
import tempfile
import threading
import zipfile
from pathlib import Path
import requests
from overrides import override
from solidlsp.ls import SolidLanguageServer
from solidlsp.ls_config import LanguageServerConfig
from solidlsp.lsp_protocol_hand... | --- +++ @@ -1,3 +1,7 @@+"""
+Provides PowerShell specific instantiation of the LanguageServer class using PowerShell Editor Services.
+Contains various configurations and settings specific to PowerShell scripting.
+"""
import logging
import os
@@ -25,6 +29,10 @@
class PowerShellLanguageServer(SolidLanguageServe... | https://raw.githubusercontent.com/oraios/serena/HEAD/src/solidlsp/language_servers/powershell_language_server.py |
Add structured docstrings to improve clarity |
import logging
import os
import shutil
from overrides import override
from solidlsp.ls import SolidLanguageServer
from solidlsp.ls_config import LanguageServerConfig
from solidlsp.ls_utils import PathUtils
from solidlsp.lsp_protocol_handler.lsp_types import InitializeParams
from solidlsp.lsp_protocol_handler.server ... | --- +++ @@ -1,3 +1,4 @@+"""Regal Language Server implementation for Rego policy files."""
import logging
import os
@@ -16,12 +17,27 @@
class RegalLanguageServer(SolidLanguageServer):
+ """
+ Provides Rego specific instantiation of the LanguageServer class using Regal.
+
+ Regal is the official linter a... | https://raw.githubusercontent.com/oraios/serena/HEAD/src/solidlsp/language_servers/regal_server.py |
Create Google-style docstrings for my code |
import logging
import os
import pathlib
import platform
import shutil
import subprocess
import threading
from typing import cast
from overrides import override
from solidlsp.ls import LanguageServerDependencyProvider, LanguageServerDependencyProviderSinglePath, SolidLanguageServer
from solidlsp.ls_config import Lang... | --- +++ @@ -1,3 +1,6 @@+"""
+Provides Rust specific instantiation of the LanguageServer class. Contains various configurations and settings specific to Rust.
+"""
import logging
import os
@@ -19,9 +22,13 @@
class RustAnalyzer(SolidLanguageServer):
+ """
+ Provides Rust specific instantiation of the Langua... | https://raw.githubusercontent.com/oraios/serena/HEAD/src/solidlsp/language_servers/rust_analyzer.py |
Write docstrings describing functionality |
import json
import logging
import os
import pathlib
import shutil
import subprocess
import threading
from overrides import override
from solidlsp.ls import SolidLanguageServer
from solidlsp.ls_config import LanguageServerConfig
from solidlsp.lsp_protocol_handler.lsp_types import InitializeParams, InitializeResult
fr... | --- +++ @@ -1,3 +1,7 @@+"""
+Ruby LSP Language Server implementation using Shopify's ruby-lsp.
+Provides modern Ruby language server capabilities with improved performance.
+"""
import json
import logging
@@ -19,8 +23,16 @@
class RubyLsp(SolidLanguageServer):
+ """
+ Provides Ruby specific instantiation o... | https://raw.githubusercontent.com/oraios/serena/HEAD/src/solidlsp/language_servers/ruby_lsp.py |
Generate missing documentation strings |
import logging
import os
import pathlib
import shutil
import subprocess
from enum import Enum
from overrides import override
from solidlsp.ls import SolidLanguageServer
from solidlsp.ls_config import LanguageServerConfig
from solidlsp.ls_utils import PlatformUtils
from solidlsp.lsp_protocol_handler.lsp_types import ... | --- +++ @@ -1,3 +1,6 @@+"""
+Provides Scala specific instantiation of the LanguageServer class. Contains various configurations and settings specific to Scala.
+"""
import logging
import os
@@ -29,6 +32,7 @@
class StaleLockMode(Enum):
+ """Mode for handling stale Metals H2 database locks."""
AUTO_CLEA... | https://raw.githubusercontent.com/oraios/serena/HEAD/src/solidlsp/language_servers/scala_language_server.py |
Turn comments into proper docstrings | import fnmatch
import logging
import os
import sys
import zipfile
from pathlib import Path
from typing import Optional
log = logging.getLogger(__name__)
class SafeZipExtractor:
def __init__(
self,
archive_path: Path,
extract_dir: Path,
verbose: bool = True,
include_patter... | --- +++ @@ -10,6 +10,15 @@
class SafeZipExtractor:
+ """
+ A utility class for extracting ZIP archives safely.
+
+ Features:
+ - Handles long file paths on Windows
+ - Skips files that fail to extract, continuing with the rest
+ - Creates necessary directories automatically
+ - Optional include... | https://raw.githubusercontent.com/oraios/serena/HEAD/src/solidlsp/util/zip.py |
Document my Python code with docstrings |
from __future__ import annotations
import logging
import re
from dataclasses import dataclass
from enum import Enum
from pathlib import Path
from typing import TYPE_CHECKING
if TYPE_CHECKING:
pass
log = logging.getLogger(__name__)
class MetalsDbStatus(Enum):
NO_DATABASE = "no_database"
"""No .metals ... | --- +++ @@ -1,3 +1,14 @@+"""
+Utilities for detecting and managing Scala Metals H2 database state.
+
+This module provides functions to detect existing Metals LSP instances by checking
+the H2 database lock file, and to clean up stale locks from crashed processes.
+
+Metals uses H2 AUTO_SERVER mode (enabled by default)... | https://raw.githubusercontent.com/oraios/serena/HEAD/src/solidlsp/util/metals_db_utils.py |
Add docstrings to improve readability | import platform
import subprocess
def subprocess_kwargs() -> dict:
kwargs = {}
if platform.system() == "Windows":
kwargs["creationflags"] = subprocess.CREATE_NO_WINDOW # type: ignore
return kwargs
def quote_arg(arg: str) -> str:
if " " not in arg:
return arg
return f'"{arg}"' | --- +++ @@ -3,6 +3,10 @@
def subprocess_kwargs() -> dict:
+ """
+ Returns a dictionary of keyword arguments for subprocess calls, adding platform-specific
+ flags that we want to use consistently.
+ """
kwargs = {}
if platform.system() == "Windows":
kwargs["creationflags"] = subproces... | https://raw.githubusercontent.com/oraios/serena/HEAD/src/solidlsp/util/subprocess_util.py |
Create docstrings for API functions |
import glob
import logging
import os
import pathlib
import shutil
import threading
from time import sleep
from typing import Any
from solidlsp.language_servers.common import RuntimeDependency, RuntimeDependencyCollection
from solidlsp.ls import LanguageServerDependencyProvider, LanguageServerDependencyProviderSingleP... | --- +++ @@ -1,3 +1,7 @@+"""
+Provides Solidity-specific instantiation of the LanguageServer class using
+the Nomic Foundation Solidity Language Server (@nomicfoundation/solidity-language-server).
+"""
import glob
import logging
@@ -18,9 +22,16 @@
class SolidityLanguageServer(SolidLanguageServer):
+ """
+ ... | https://raw.githubusercontent.com/oraios/serena/HEAD/src/solidlsp/language_servers/solidity_language_server.py |
Generate docstrings for script automation |
import gzip
import hashlib
import logging
import os
import platform
import shutil
import socket
import stat
import urllib.request
from typing import Any
# Download timeout in seconds (prevents indefinite hangs)
DOWNLOAD_TIMEOUT_SECONDS = 120
from solidlsp.ls import LanguageServerDependencyProvider, LanguageServerDep... | --- +++ @@ -1,3 +1,7 @@+"""
+Provides TOML specific instantiation of the LanguageServer class using Taplo.
+Contains various configurations and settings specific to TOML files.
+"""
import gzip
import hashlib
@@ -40,6 +44,7 @@
def _verify_sha256(file_path: str, expected_hash: str) -> bool:
+ """Verify SHA256... | https://raw.githubusercontent.com/oraios/serena/HEAD/src/solidlsp/language_servers/taplo_server.py |
Generate descriptive docstrings automatically |
import logging
import os
import pathlib
import shutil
import subprocess
from typing import Any, cast
from solidlsp.ls import LanguageServerDependencyProvider, LanguageServerDependencyProviderSinglePath, SolidLanguageServer
from solidlsp.ls_config import LanguageServerConfig
from solidlsp.lsp_protocol_handler.lsp_type... | --- +++ @@ -1,3 +1,6 @@+"""
+SystemVerilog language server using verible-verilog-ls.
+"""
import logging
import os
@@ -17,6 +20,10 @@
class SystemVerilogLanguageServer(SolidLanguageServer):
+ """
+ SystemVerilog language server using verible-verilog-ls.
+ Supports .sv, .svh, .v, .vh files.
+ """
... | https://raw.githubusercontent.com/oraios/serena/HEAD/src/solidlsp/language_servers/systemverilog_server.py |
Help me add docstrings to my project | import logging
import os
import pathlib
import subprocess
from typing import Any
from overrides import override
from solidlsp.ls import SolidLanguageServer
from solidlsp.ls_config import LanguageServerConfig
from solidlsp.lsp_protocol_handler.lsp_types import InitializeParams
from solidlsp.lsp_protocol_handler.server... | --- +++ @@ -16,6 +16,7 @@
class RLanguageServer(SolidLanguageServer):
+ """R Language Server implementation using the languageserver R package."""
@override
def _get_wait_time_for_cross_file_referencing(self) -> float:
@@ -33,6 +34,7 @@
@staticmethod
def _check_r_installation() -> None:
+ ... | https://raw.githubusercontent.com/oraios/serena/HEAD/src/solidlsp/language_servers/r_language_server.py |
Generate missing documentation strings |
import logging
import os
import pathlib
from dataclasses import dataclass, field
from typing import TYPE_CHECKING, Any
from sensai.util.string import ToStringMixin
if TYPE_CHECKING:
from solidlsp.ls_config import Language
log = logging.getLogger(__name__)
@dataclass
class SolidLSPSettings:
solidlsp_dir: s... | --- +++ @@ -1,3 +1,6 @@+"""
+Defines settings for Solid-LSP
+"""
import logging
import os
@@ -45,6 +48,14 @@ self.settings = settings or {}
def get(self, key: str, default_value: Any = None) -> Any:
+ """
+ Returns the custom setting for the given key or the default valu... | https://raw.githubusercontent.com/oraios/serena/HEAD/src/solidlsp/settings.py |
Turn comments into proper docstrings | import logging
import os
import shutil
from typing import cast
from overrides import override
from solidlsp.ls import SolidLanguageServer
from solidlsp.ls_config import LanguageServerConfig
from solidlsp.ls_utils import PathUtils, PlatformUtils
from solidlsp.lsp_protocol_handler.lsp_types import InitializeParams
from... | --- +++ @@ -18,6 +18,9 @@
class TerraformLS(SolidLanguageServer):
+ """
+ Provides Terraform specific instantiation of the LanguageServer class using terraform-ls.
+ """
@override
def is_ignored_dirname(self, dirname: str) -> bool:
@@ -25,6 +28,7 @@
@staticmethod
def _determine_log_l... | https://raw.githubusercontent.com/oraios/serena/HEAD/src/solidlsp/language_servers/terraform_ls.py |
Create simple docstrings for beginners | import logging
import os
import pathlib
import subprocess
import time
from overrides import override
from solidlsp import ls_types
from solidlsp.ls import SolidLanguageServer
from solidlsp.ls_config import LanguageServerConfig
from solidlsp.lsp_protocol_handler.lsp_types import InitializeParams
from solidlsp.lsp_prot... | --- +++ @@ -17,6 +17,9 @@
class SourceKitLSP(SolidLanguageServer):
+ """
+ Provides Swift specific instantiation of the LanguageServer class using sourcekit-lsp.
+ """
@override
def is_ignored_dirname(self, dirname: str) -> bool:
@@ -29,6 +32,7 @@
@staticmethod
def _get_sourcekit_lsp... | https://raw.githubusercontent.com/oraios/serena/HEAD/src/solidlsp/language_servers/sourcekit_lsp.py |
Create documentation for each function signature |
import json
import logging
import os
import pathlib
import re
import shutil
import subprocess
import threading
from overrides import override
from solidlsp.ls import SolidLanguageServer
from solidlsp.ls_config import LanguageServerConfig
from solidlsp.lsp_protocol_handler.lsp_types import InitializeParams
from solid... | --- +++ @@ -1,3 +1,7 @@+"""
+Provides Ruby specific instantiation of the LanguageServer class using Solargraph.
+Contains various configurations and settings specific to Ruby.
+"""
import json
import logging
@@ -20,8 +24,16 @@
class Solargraph(SolidLanguageServer):
+ """
+ Provides Ruby specific instantia... | https://raw.githubusercontent.com/oraios/serena/HEAD/src/solidlsp/language_servers/solargraph.py |
Generate docstrings for this script |
import logging
import os
import pathlib
import platform
import shutil
import subprocess
from overrides import override
from solidlsp.ls import SolidLanguageServer
from solidlsp.ls_config import LanguageServerConfig
from solidlsp.lsp_protocol_handler.lsp_types import InitializeParams
from solidlsp.lsp_protocol_handle... | --- +++ @@ -1,3 +1,6 @@+"""
+Provides Zig specific instantiation of the LanguageServer class using ZLS (Zig Language Server).
+"""
import logging
import os
@@ -18,6 +21,9 @@
class ZigLanguageServer(SolidLanguageServer):
+ """
+ Provides Zig specific instantiation of the LanguageServer class using ZLS.
+ ... | https://raw.githubusercontent.com/oraios/serena/HEAD/src/solidlsp/language_servers/zls.py |
Add detailed docstrings explaining each function |
import fnmatch
from collections.abc import Iterable
from dataclasses import dataclass, field
from enum import Enum
from typing import TYPE_CHECKING, Self
if TYPE_CHECKING:
from solidlsp import SolidLanguageServer
class FilenameMatcher:
def __init__(self, *patterns: str) -> None:
self.patterns = patt... | --- +++ @@ -1,3 +1,6 @@+"""
+Configuration objects for language servers
+"""
import fnmatch
from collections.abc import Iterable
@@ -11,6 +14,9 @@
class FilenameMatcher:
def __init__(self, *patterns: str) -> None:
+ """
+ :param patterns: fnmatch-compatible patterns
+ """
self.p... | https://raw.githubusercontent.com/oraios/serena/HEAD/src/solidlsp/ls_config.py |
Add docstrings to clarify complex logic |
import logging
import os
import pathlib
import shutil
from typing import Any
from solidlsp.language_servers.common import RuntimeDependency, RuntimeDependencyCollection
from solidlsp.ls import LanguageServerDependencyProvider, LanguageServerDependencyProviderSinglePath, SolidLanguageServer
from solidlsp.ls_config imp... | --- +++ @@ -1,3 +1,7 @@+"""
+Provides YAML specific instantiation of the LanguageServer class using yaml-language-server.
+Contains various configurations and settings specific to YAML files.
+"""
import logging
import os
@@ -15,9 +19,14 @@
class YamlLanguageServer(SolidLanguageServer):
+ """
+ Provides Y... | https://raw.githubusercontent.com/oraios/serena/HEAD/src/solidlsp/language_servers/yaml_language_server.py |
Generate docstrings with examples | # Code generated. DO NOT EDIT.
# LSP v3.17.0
# TODO: Look into use of https://pypi.org/project/ts2python/ to generate the types for https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/
from typing import Any, Union
from solidlsp.lsp_protocol_handler import lsp_types
class Lsp... | --- +++ @@ -2,6 +2,32 @@ # LSP v3.17.0
# TODO: Look into use of https://pypi.org/project/ts2python/ to generate the types for https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/
+"""
+This file provides the python interface corresponding to the requests and notifications defin... | https://raw.githubusercontent.com/oraios/serena/HEAD/src/solidlsp/lsp_protocol_handler/lsp_requests.py |
Fully document this Python code with docstrings |
class LSPConstants:
# the key for uri used to represent paths
URI = "uri"
# the key for range, which is a from and to position within a text document
RANGE = "range"
# A key used in LocationLink type, used as the span of the origin link
ORIGIN_SELECTION_RANGE = "originSelectionRange"
#... | --- +++ @@ -1,6 +1,12 @@+"""
+This module contains constants used in the LSP protocol.
+"""
class LSPConstants:
+ """
+ This class contains constants used in the LSP protocol.
+ """
# the key for uri used to represent paths
URI = "uri"
@@ -60,4 +66,4 @@ SEVERITY = "severity"
# The m... | https://raw.githubusercontent.com/oraios/serena/HEAD/src/solidlsp/lsp_protocol_handler/lsp_constants.py |
Add docstrings to existing functions | import dataclasses
import hashlib
import json
import logging
import os
import pathlib
import shutil
import subprocess
import threading
from abc import ABC, abstractmethod
from collections import defaultdict
from collections.abc import Hashable, Iterator
from contextlib import contextmanager
from copy import copy
from p... | --- +++ @@ -56,6 +56,7 @@
@dataclasses.dataclass(kw_only=True)
class ReferenceInSymbol:
+ """A symbol retrieved when requesting reference to a symbol, together with the location of the reference"""
symbol: ls_types.UnifiedSymbolInformation
line: int
@@ -63,6 +64,9 @@
class LSPFileBuffer:
+ """
... | https://raw.githubusercontent.com/oraios/serena/HEAD/src/solidlsp/ls.py |
Create docstrings for API functions |
import logging
import os
import pathlib
import shutil
import threading
from typing import Any, cast
from overrides import override
from sensai.util.logging import LogTime
from solidlsp import ls_types
from solidlsp.ls import LanguageServerDependencyProvider, LanguageServerDependencyProviderSinglePath, SolidLanguageS... | --- +++ @@ -1,3 +1,6 @@+"""
+Provides TypeScript specific instantiation of the LanguageServer class. Contains various configurations and settings specific to TypeScript.
+"""
import logging
import os
@@ -37,6 +40,17 @@
def prefer_non_node_modules_definition(definitions: list[ls_types.Location]) -> ls_types.Loca... | https://raw.githubusercontent.com/oraios/serena/HEAD/src/solidlsp/language_servers/typescript_language_server.py |
Write documentation strings for class attributes |
import dataclasses
import json
import logging
import os
from typing import Any, Union
from .lsp_types import ErrorCodes
StringDict = dict[str, Any]
PayloadLike = Union[list[StringDict], StringDict, None, bool]
CONTENT_LENGTH = "Content-Length: "
ENCODING = "utf-8"
log = logging.getLogger(__name__)
@dataclasses.dat... | --- +++ @@ -1,3 +1,32 @@+"""
+This file provides the implementation of the JSON-RPC client, that launches and
+communicates with the language server.
+
+The initial implementation of this file was obtained from
+https://github.com/predragnikolic/OLSP under the MIT License with the following terms:
+
+MIT License
+
+Cop... | https://raw.githubusercontent.com/oraios/serena/HEAD/src/solidlsp/lsp_protocol_handler/server.py |
Help me comply with documentation standards | import asyncio
import json
import logging
import os
import platform
import subprocess
import threading
import time
from collections.abc import Callable
from dataclasses import dataclass
from queue import Empty, Queue
from typing import Any
import psutil
from sensai.util.string import ToStringMixin
from solidlsp.ls_co... | --- +++ @@ -38,6 +38,9 @@
class LanguageServerTerminatedException(Exception):
+ """
+ Exception raised when the language server process has terminated unexpectedly.
+ """
def __init__(self, message: str, language: Language, cause: Exception | None = None) -> None:
super().__init__(message)
... | https://raw.githubusercontent.com/oraios/serena/HEAD/src/solidlsp/ls_process.py |
Create docstrings for API functions | from typing import TYPE_CHECKING, Any, Union
from solidlsp.lsp_protocol_handler import lsp_types
if TYPE_CHECKING:
from .ls_process import LanguageServerProcess
class LanguageServerRequest:
def __init__(self, handler: "LanguageServerProcess"):
self.handler = handler
def _send_request(self, meth... | --- +++ @@ -14,162 +14,370 @@ return self.handler.send_request(method, params)
def implementation(self, params: lsp_types.ImplementationParams) -> Union["lsp_types.Definition", list["lsp_types.LocationLink"], None]:
+ """A request to resolve the implementation locations of a symbol at a given text... | https://raw.githubusercontent.com/oraios/serena/HEAD/src/solidlsp/ls_request.py |
Add return value explanations in docstrings |
from solidlsp.ls_config import Language
class SolidLSPException(Exception):
def __init__(self, message: str, cause: Exception | None = None) -> None:
self.cause = cause
super().__init__(message)
def is_language_server_terminated(self) -> bool:
from .ls_process import LanguageServerTe... | --- +++ @@ -1,18 +1,37 @@+"""
+This module contains the exceptions raised by the framework.
+"""
from solidlsp.ls_config import Language
class SolidLSPException(Exception):
def __init__(self, message: str, cause: Exception | None = None) -> None:
+ """
+ Initializes the exception with the giv... | https://raw.githubusercontent.com/oraios/serena/HEAD/src/solidlsp/ls_exceptions.py |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.