Skip to content

Commit

Permalink
chore: fix lints
Browse files Browse the repository at this point in the history
  • Loading branch information
alcarney committed May 29, 2024
1 parent ee88473 commit e8283d5
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 11 deletions.
13 changes: 8 additions & 5 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,16 @@
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#
import os
import sys
sys.path.insert(0, os.path.abspath('./ext'))

import importlib.metadata
import os
import pathlib
import re
import sys

from docutils import nodes

sys.path.insert(0, os.path.abspath("./ext"))


# -- Project information -----------------------------------------------------

Expand Down Expand Up @@ -62,7 +63,9 @@
autodoc_typehints = "description"
autodoc_typehints_description_target = "all"

example_server_dir = pathlib.Path(__file__).parent.parent.parent / "examples" / "servers"
example_server_dir = (
pathlib.Path(__file__).parent.parent.parent / "examples" / "servers"
)

intersphinx_mapping = {
"python": ("https://docs.python.org/3/", None),
Expand Down
11 changes: 5 additions & 6 deletions docs/source/ext/examples.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
"""Documentation for the example servers"""

from __future__ import annotations

import importlib.util as imutil
import os
import pathlib
import typing
import importlib.util as imutil

from docutils import nodes
from docutils.parsers.rst import directives
from sphinx.util.docutils import SphinxDirective
from sphinx.util.logging import getLogger
Expand All @@ -16,6 +16,7 @@

logger = getLogger(__name__)


class ExampleServerDirective(SphinxDirective):
"""Automate the process of documenting example servers.
Expand Down Expand Up @@ -74,13 +75,11 @@ def run(self):

# Confusingly, these are processed in reverse order...
self.state_machine.insert_input(content, "<examples>")
self.state_machine.insert_input(
self.get_docstring(filename), str(filename)
)
self.state_machine.insert_input(self.get_docstring(filename), str(filename))

return []


def setup(app: Sphinx):
app.add_config_value("example_server_dir", "", rebuild='env')
app.add_config_value("example_server_dir", "", rebuild="env")
app.add_directive("example-server", ExampleServerDirective)
2 changes: 2 additions & 0 deletions examples/hello-world/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

server = LanguageServer("example-server", "v0.1")


@server.feature(
types.TEXT_DOCUMENT_COMPLETION,
types.CompletionOptions(trigger_characters=["."]),
Expand All @@ -19,5 +20,6 @@ def completions(params: types.CompletionParams):
types.CompletionItem(label="friend"),
]


if __name__ == "__main__":
server.start_io()

0 comments on commit e8283d5

Please sign in to comment.