diff --git a/docs/conf.py b/docs/conf.py index b356a76..1e5c225 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -3,8 +3,8 @@ https://www.sphinx-doc.org/en/master/usage/configuration.html """ -from autotools_language_server import __version__ as version # type: ignore -from autotools_language_server._metainfo import ( # type: ignore +from make_language_server import __version__ as version # type: ignore +from make_language_server._metainfo import ( # type: ignore author, copyright, project, diff --git a/docs/resources/configure.md b/docs/resources/configure.md index 1c7920f..fa5360c 100644 --- a/docs/resources/configure.md +++ b/docs/resources/configure.md @@ -17,11 +17,15 @@ For vim: ```json { "languageserver": { - "autotools": { - "command": "autotools-language-server", + "config": { + "command": "autoconf-language-server", + "filetypes": [ + "config" + ] + }, + "make": { + "command": "make-language-server", "filetypes": [ - "autoconf", - "automake", "make" ] } @@ -34,13 +38,23 @@ For vim: `~/.config/nvim/init.vim`: ```vim -if executable('autotools-language-server') +if executable('autoconf-language-server') + augroup lsp + autocmd! + autocmd User lsp_setup call lsp#register_server({ + \ 'name': 'config', + \ 'cmd': {server_info->['autoconf-language-server']}, + \ 'whitelist': ['config'], + \ }) + augroup END +endif +if executable('make-language-server') augroup lsp autocmd! autocmd User lsp_setup call lsp#register_server({ - \ 'name': 'autotools', - \ 'cmd': {server_info->['autotools-language-server']}, - \ 'whitelist': ['autoconf', 'automake', 'make'], + \ 'name': 'make', + \ 'cmd': {server_info->['make-language-server']}, + \ 'whitelist': ['make'], \ }) augroup END endif @@ -52,11 +66,20 @@ endif ```lua vim.api.nvim_create_autocmd({ "BufEnter" }, { - pattern = { "configure.ac", "Makefile.am", "Makefile" }, + pattern = { "configure.ac" }, callback = function() vim.lsp.start({ - name = "autotools", - cmd = { "autotools-language-server" } + name = "config", + cmd = { "config-language-server" } + }) + end, +}) +vim.api.nvim_create_autocmd({ "BufEnter" }, { + pattern = { "Makefile.am", "Makefile" }, + callback = function() + vim.lsp.start({ + name = "make", + cmd = { "make-language-server" } }) end, }) @@ -69,9 +92,14 @@ vim.api.nvim_create_autocmd({ "BufEnter" }, { ```lisp (make-lsp-client :new-connection (lsp-stdio-connection - `(,(executable-find "autotools-language-server"))) - :activation-fn (lsp-activate-on "configure.ac" "Makefile.am" "Makefile") - :server-id "autotools"))) + `(,(executable-find "autoconf-language-server"))) + :activation-fn (lsp-activate-on "configure.ac") + :server-id "config"))) +(make-lsp-client :new-connection +(lsp-stdio-connection + `(,(executable-find "make-language-server"))) + :activation-fn (lsp-activate-on "Makefile.am" "Makefile") + :server-id "make"))) ``` ## [Helix](https://helix-editor.com/) @@ -81,18 +109,17 @@ vim.api.nvim_create_autocmd({ "BufEnter" }, { ```toml [[language]] name = "autoconf" -language-servers = [ "autotools-language-server",] - -[[language]] -name = "automake" -language-servers = [ "autotools-language-server",] +language-servers = [ "autoconf-language-server",] [[language]] name = "make" -language-servers = [ "autotools-language-server",] +language-servers = [ "make-language-server",] -[language_server.autotools-language-server] -command = "autotools-language-server" +[language_server.autoconf-language-server] +command = "autoconf-language-server" + +[language_server.make-language-server] +command = "make-language-server" ``` ## [KaKoune](https://kakoune.org/) @@ -102,9 +129,13 @@ command = "autotools-language-server" `~/.config/kak-lsp/kak-lsp.toml`: ```toml -[language_server.autotools-language-server] -filetypes = [ "autoconf", "automake", "make",] -command = "autotools-language-server" +[language_server.autoconf-language-server] +filetypes = [ "autoconf",] +command = "autoconf-language-server" + +[language_server.make-language-server] +filetypes = [ "make",] +command = "make-language-server" ``` ## [Sublime](https://www.sublimetext.com) @@ -114,12 +145,19 @@ command = "autotools-language-server" ```json { "clients": { - "autotools": { + "autoconf": { + "command": [ + "autoconf-language-server" + ], + "enabled": true, + "selector": "source.autoconf" + }, + "make": { "command": [ - "autotools-language-server" + "make-language-server" ], "enabled": true, - "selector": "source.autotools" + "selector": "source.make" } } } @@ -135,7 +173,7 @@ command = "autotools-language-server" ```json { - "glspc.serverPath": "autotools-language-server", + "glspc.serverPath": "make-language-server", "glspc.languageId": "make" } ``` diff --git a/docs/resources/install.md b/docs/resources/install.md index 388c2b0..58e2a9b 100644 --- a/docs/resources/install.md +++ b/docs/resources/install.md @@ -3,7 +3,7 @@ ## [AUR](https://aur.archlinux.org/packages/autotools-language-server) ```sh -yay -S autotools-language-server +paru -S autotools-language-server ``` ## [NUR](https://nur.nix-community.org/repos/Freed-Wu) diff --git a/pyproject.toml b/pyproject.toml index 297403f..d38e9dc 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -43,12 +43,26 @@ Download = "https://github.com/Freed-Wu/autotools-language-server/releases" Source = "https://github.com/Freed-Wu/autotools-language-server" [project.scripts] -autotools-language-server = "autotools_language_server.__main__:main" +make-language-server = "make_language_server.__main__:main" +autoconf-language-server = "make_language_server.__main__:main" +autotools-language-server = "make_language_server.__main__:main" [tool.setuptools.data-files] -"share/man/man1" = ["sdist/autotools-language-server.1"] -"share/bash-completion/completions" = ["sdist/autotools-language-server"] -"share/zsh/site-functions" = ["sdist/_autotools-language-server"] +"share/man/man1" = [ + "sdist/make-language-server.1", + "sdist/autoconf-language-server.1", + "sdist/autotools-language-server.1", +] +"share/bash-completion/completions" = [ + "sdist/make-language-server", + "sdist/autoconf-language-server", + "sdist/autotools-language-server", +] +"share/zsh/site-functions" = [ + "sdist/_make-language-server", + "sdist/_autoconf-language-server", + "sdist/_autotools-language-server", +] [tool.setuptools.dynamic.dependencies] file = "requirements.txt" @@ -65,10 +79,10 @@ file = "requirements/misc.txt" # end: scripts/update-pyproject.toml.pl [tool.setuptools_scm] -write_to = "src/autotools_language_server/_version.py" +write_to = "src/make_language_server/_version.py" [tool.setuptools-generate] -write-to = "src/autotools_language_server/_metainfo.py" +write-to = "src/make_language_server/_metainfo.py" [tool.setuptools-generate.metainfo-template] file = "templates/metainfo.py.j2" diff --git a/src/autotools_language_server/__init__.py b/src/autoconf_language_server/__init__.py similarity index 92% rename from src/autotools_language_server/__init__.py rename to src/autoconf_language_server/__init__.py index 0980d42..a8f8de2 100644 --- a/src/autotools_language_server/__init__.py +++ b/src/autoconf_language_server/__init__.py @@ -12,4 +12,4 @@ __all__ = ["__version__", "__version_tuple__"] -FILETYPE = Literal["config", "make"] +FILETYPE = Literal["config"] diff --git a/src/autoconf_language_server/__main__.py b/src/autoconf_language_server/__main__.py new file mode 100644 index 0000000..c16b3ea --- /dev/null +++ b/src/autoconf_language_server/__main__.py @@ -0,0 +1,74 @@ +r"""This module can be called by +`python -m `_. +""" + +from argparse import ArgumentParser, RawDescriptionHelpFormatter +from contextlib import suppress +from datetime import datetime + +from make_language_server import __version__ + +from . import FILETYPE +from . import __name__ as NAME + +NAME = NAME.replace("_", "-") +VERSION = rf"""{NAME} {__version__} +Copyright (C) {datetime.now().year} +Written by Wu Zhenyu +""" +EPILOG = """ +Report bugs to . +""" + + +def get_parser(): + r"""Get a parser for unit test.""" + parser = ArgumentParser( + epilog=EPILOG, + formatter_class=RawDescriptionHelpFormatter, + ) + with suppress(ImportError): + import shtab + + shtab.add_argument_to(parser) + parser.add_argument("--version", version=VERSION, action="version") + parser.add_argument( + "--generate-schema", + choices=FILETYPE.__args__, # type: ignore + help="generate schema json", + ) + parser.add_argument( + "--indent", + type=int, + default=2, + help="generated json's indent", + ) + parser.add_argument( + "--color", + choices=["auto", "always", "never"], + default="auto", + help="when to display color", + ) + return parser + + +def main(): + r"""Parse arguments and provide shell completions.""" + parser = get_parser() + args = parser.parse_args() + + if args.generate_schema: + from lsp_tree_sitter.utils import pprint + + from .misc import get_schema + + pprint(get_schema(args.generate_schema), indent=args.indent) + exit() + + from .server import AutoconfLanguageServer + + AutoconfLanguageServer(NAME, __version__).start_io() + + +if __name__ == "__main__": + main() diff --git a/src/autotools_language_server/assets/json/config.json b/src/autoconf_language_server/assets/json/config.json similarity index 100% rename from src/autotools_language_server/assets/json/config.json rename to src/autoconf_language_server/assets/json/config.json diff --git a/src/autotools_language_server/misc/__init__.py b/src/autoconf_language_server/misc/__init__.py similarity index 100% rename from src/autotools_language_server/misc/__init__.py rename to src/autoconf_language_server/misc/__init__.py diff --git a/src/autotools_language_server/misc/autoconf.py b/src/autoconf_language_server/misc/autoconf.py similarity index 98% rename from src/autotools_language_server/misc/autoconf.py rename to src/autoconf_language_server/misc/autoconf.py index 1fbe6b9..28d3f85 100644 --- a/src/autotools_language_server/misc/autoconf.py +++ b/src/autoconf_language_server/misc/autoconf.py @@ -5,8 +5,7 @@ from typing import Any from lsp_tree_sitter.misc import get_info - -from .._metainfo import SOURCE, project +from make_language_server._metainfo import SOURCE, project START = " -- Macro: " BEGIN = "‘" diff --git a/src/autotools_language_server/py.typed b/src/autoconf_language_server/py.typed similarity index 100% rename from src/autotools_language_server/py.typed rename to src/autoconf_language_server/py.typed diff --git a/src/autoconf_language_server/server.py b/src/autoconf_language_server/server.py new file mode 100644 index 0000000..3f08743 --- /dev/null +++ b/src/autoconf_language_server/server.py @@ -0,0 +1,134 @@ +r"""Server +========== +""" + +import re +from typing import Any + +from lsprotocol.types import ( + TEXT_DOCUMENT_COMPLETION, + TEXT_DOCUMENT_HOVER, + CompletionItem, + CompletionItemKind, + CompletionList, + CompletionParams, + Hover, + MarkupContent, + MarkupKind, + Position, + Range, + TextDocumentPositionParams, +) +from pygls.server import LanguageServer + +from .utils import get_schema + + +class AutoconfLanguageServer(LanguageServer): + r"""Autoconf language server.""" + + def __init__(self, *args: Any, **kwargs: Any) -> None: + r"""Init. + + :param args: + :type args: Any + :param kwargs: + :type kwargs: Any + :rtype: None + """ + super().__init__(*args) + + @self.feature(TEXT_DOCUMENT_HOVER) + def hover(params: TextDocumentPositionParams) -> Hover | None: + r"""Hover. + + :param params: + :type params: TextDocumentPositionParams + :rtype: Hover | None + """ + text, _range = self._cursor_word( + params.text_document.uri, params.position, True + ) + if ( + description := get_schema() + .get("properties", {}) + .get(text, {}) + .get("description") + ): + return Hover( + MarkupContent(MarkupKind.Markdown, description), + _range, + ) + + @self.feature(TEXT_DOCUMENT_COMPLETION) + def completions(params: CompletionParams) -> CompletionList: + r"""Completions. + + :param params: + :type params: CompletionParams + :rtype: CompletionList + """ + text, _ = self._cursor_word( + params.text_document.uri, params.position, False, r"[^$() ]" + ) + items = [ + CompletionItem( + k, + kind=CompletionItemKind.Function, + documentation=MarkupContent( + MarkupKind.Markdown, v.get("description", "") + ), + insert_text=k, + ) + for k, v in get_schema().get("properties", {}).items() + if k.startswith(text) + ] + return CompletionList(is_incomplete=False, items=items) + + def _cursor_line(self, uri: str, position: Position) -> str: + r"""Cursor line. + + :param uri: + :type uri: str + :param position: + :type position: Position + :rtype: str + """ + document = self.workspace.get_document(uri) + return document.source.splitlines()[position.line] + + def _cursor_word( + self, + uri: str, + position: Position, + include_all: bool = True, + regex: str = r"\w+", + ) -> tuple[str, Range]: + """Cursor word. + + :param self: + :param uri: + :type uri: str + :param position: + :type position: Position + :param include_all: + :type include_all: bool + :param regex: + :type regex: str + :rtype: tuple[str, Range] + """ + line = self._cursor_line(uri, position) + for m in re.finditer(regex, line): + if m.start() <= position.character <= m.end(): + end = m.end() if include_all else position.character + return ( + line[m.start() : end], + Range( + Position(position.line, m.start()), + Position(position.line, end), + ), + ) + return ( + "", + Range(Position(position.line, 0), Position(position.line, 0)), + ) diff --git a/src/autoconf_language_server/utils.py b/src/autoconf_language_server/utils.py new file mode 100644 index 0000000..7536216 --- /dev/null +++ b/src/autoconf_language_server/utils.py @@ -0,0 +1,60 @@ +r"""Utils +========= +""" + +import json +import os +from typing import Any + +from tree_sitter.binding import Query +from tree_sitter_languages import get_language + +from . import FILETYPE + +SCHEMAS = {} +QUERIES = {} + + +def get_query(name: str, filetype: FILETYPE = "config") -> Query: + r"""Get query. + + :param name: + :type name: str + :param filetype: + :type filetype: FILETYPE + :rtype: Query + """ + if name not in QUERIES: + with open( + os.path.join( + os.path.join( + os.path.join(os.path.dirname(__file__), "assets"), + "queries", + ), + f"{name}{os.path.extsep}scm", + ) + ) as f: + text = f.read() + language = get_language(filetype) + QUERIES[name] = language.query(text) + return QUERIES[name] + + +def get_schema(filetype: FILETYPE = "config") -> dict[str, Any]: + r"""Get schema. + + :param filetype: + :type filetype: FILETYPE + :rtype: dict[str, Any] + """ + if filetype not in SCHEMAS: + file = os.path.join( + os.path.join( + os.path.join(os.path.dirname(__file__), "assets"), + "json", + ), + f"{filetype}.json", + ) + with open(file) as f: + SCHEMAS[filetype] = json.load(f) + return SCHEMAS[filetype] diff --git a/src/make_language_server/__init__.py b/src/make_language_server/__init__.py new file mode 100644 index 0000000..fa4105f --- /dev/null +++ b/src/make_language_server/__init__.py @@ -0,0 +1,15 @@ +r"""Provide ``__version__`` for +`importlib.metadata.version() `_. +""" + +from typing import Literal + +try: + from ._version import __version__, __version_tuple__ # type: ignore +except ImportError: # for setuptools-generate + __version__ = "rolling" + __version_tuple__ = (0, 0, 0, __version__, "") + +__all__ = ["__version__", "__version_tuple__"] + +FILETYPE = Literal["make"] diff --git a/src/autotools_language_server/__main__.py b/src/make_language_server/__main__.py similarity index 92% rename from src/autotools_language_server/__main__.py rename to src/make_language_server/__main__.py index 79a73ad..4600640 100644 --- a/src/autotools_language_server/__main__.py +++ b/src/make_language_server/__main__.py @@ -72,22 +72,21 @@ def main(): from tree_sitter_languages import get_parser as _get_parser from .finders import DIAGNOSTICS_FINDER_CLASSES - from .utils import get_filetype parser = _get_parser("make") result = check( args.check, parser.parse, DIAGNOSTICS_FINDER_CLASSES, - get_filetype, + None, args.color, ) if args.check: exit(result) - from .server import AutotoolsLanguageServer + from .server import MakeLanguageServer - AutotoolsLanguageServer(NAME, __version__).start_io() + MakeLanguageServer(NAME, __version__).start_io() if __name__ == "__main__": diff --git a/src/autotools_language_server/assets/json/make.json b/src/make_language_server/assets/json/make.json similarity index 100% rename from src/autotools_language_server/assets/json/make.json rename to src/make_language_server/assets/json/make.json diff --git a/src/autotools_language_server/assets/queries/define.scm b/src/make_language_server/assets/queries/define.scm similarity index 100% rename from src/autotools_language_server/assets/queries/define.scm rename to src/make_language_server/assets/queries/define.scm diff --git a/src/autotools_language_server/assets/queries/include.scm b/src/make_language_server/assets/queries/include.scm similarity index 100% rename from src/autotools_language_server/assets/queries/include.scm rename to src/make_language_server/assets/queries/include.scm diff --git a/src/autotools_language_server/finders.py b/src/make_language_server/finders.py similarity index 100% rename from src/autotools_language_server/finders.py rename to src/make_language_server/finders.py diff --git a/src/make_language_server/misc/__init__.py b/src/make_language_server/misc/__init__.py new file mode 100644 index 0000000..2d40343 --- /dev/null +++ b/src/make_language_server/misc/__init__.py @@ -0,0 +1,21 @@ +r"""Misc +======== +""" + +from typing import Any + + +def get_schema(filetype: str) -> dict[str, Any]: + r"""Get schema. + + :param filetype: + :type filetype: str + :rtype: dict[str, Any] + """ + if filetype == "config": + from .autoconf import init_schema + elif filetype == "make": + from .make import init_schema + else: + raise NotImplementedError(filetype) + return init_schema()[filetype] diff --git a/src/autotools_language_server/misc/make.py b/src/make_language_server/misc/make.py similarity index 100% rename from src/autotools_language_server/misc/make.py rename to src/make_language_server/misc/make.py diff --git a/src/make_language_server/py.typed b/src/make_language_server/py.typed new file mode 100644 index 0000000..e69de29 diff --git a/src/autotools_language_server/server.py b/src/make_language_server/server.py similarity index 72% rename from src/autotools_language_server/server.py rename to src/make_language_server/server.py index 56daa9d..1cbf0eb 100644 --- a/src/autotools_language_server/server.py +++ b/src/make_language_server/server.py @@ -35,11 +35,11 @@ DefinitionFinder, ReferenceFinder, ) -from .utils import get_filetype, get_schema +from .utils import get_schema -class AutotoolsLanguageServer(LanguageServer): - r"""Autotools language server.""" +class MakeLanguageServer(LanguageServer): + r"""Make language server.""" def __init__(self, *args: Any, **kwargs: Any) -> None: r"""Init. @@ -63,8 +63,6 @@ def did_change(params: DidChangeTextDocumentParams) -> None: :type params: DidChangeTextDocumentParams :rtype: None """ - if get_filetype(params.text_document.uri) != "make": - return None document = self.workspace.get_document(params.text_document.uri) self.trees[document.uri] = self.parser.parse( document.source.encode() @@ -84,8 +82,6 @@ def definition(params: TextDocumentPositionParams) -> list[Location]: :type params: TextDocumentPositionParams :rtype: list[Location] """ - if get_filetype(params.text_document.uri) != "make": - return [] document = self.workspace.get_document(params.text_document.uri) uni = PositionFinder(params.position).find( document.uri, self.trees[document.uri] @@ -107,8 +103,6 @@ def references(params: TextDocumentPositionParams) -> list[Location]: :type params: TextDocumentPositionParams :rtype: list[Location] """ - if get_filetype(params.text_document.uri) != "make": - return [] document = self.workspace.get_document(params.text_document.uri) uni = PositionFinder(params.position).find( document.uri, self.trees[document.uri] @@ -130,55 +124,45 @@ def hover(params: TextDocumentPositionParams) -> Hover | None: :type params: TextDocumentPositionParams :rtype: Hover | None """ - filetype = get_filetype(params.text_document.uri) - if filetype == "": + document = self.workspace.get_document(params.text_document.uri) + uni = PositionFinder(params.position).find( + document.uri, self.trees[document.uri] + ) + if uni is None: return None - if filetype == "make": - document = self.workspace.get_document( - params.text_document.uri - ) - uni = PositionFinder(params.position).find( - document.uri, self.trees[document.uri] - ) - if uni is None: - return None - text = uni.get_text() - _range = uni.get_range() - parent = uni.node.parent - if parent is None: - return None - if parent.type in [ - "prerequisites", - "variable_reference", - "arguments", - ]: - result = "\n".join( - DefinitionFinder.uni2document(uni) - for uni in DefinitionFinder(uni.node).find_all( - document.uri, self.trees[document.uri] - ) + text = uni.get_text() + _range = uni.get_range() + parent = uni.node.parent + if parent is None: + return None + if parent.type in [ + "prerequisites", + "variable_reference", + "arguments", + ]: + result = "\n".join( + DefinitionFinder.uni2document(uni) + for uni in DefinitionFinder(uni.node).find_all( + document.uri, self.trees[document.uri] ) - if result != "": - return Hover( - MarkupContent(MarkupKind.Markdown, result), - _range, - ) - if parent.type not in [ - "variable_reference", - "function_call", - "conditional", - "ifneq_directive", - "else_directive", - "define_directive", - "include_directive", - ]: - return None - else: - text, _range = self._cursor_word( - params.text_document.uri, params.position, True ) + if result != "": + return Hover( + MarkupContent(MarkupKind.Markdown, result), + _range, + ) + if parent.type not in [ + "variable_reference", + "function_call", + "conditional", + "ifneq_directive", + "else_directive", + "define_directive", + "include_directive", + ]: + return None if ( - description := get_schema(filetype) + description := get_schema() .get("properties", {}) .get(text, {}) .get("description") @@ -192,13 +176,14 @@ def hover(params: TextDocumentPositionParams) -> Hover | None: def completions(params: CompletionParams) -> CompletionList: r"""Completions. + .. todo:: + Distinguish different node type without + ``self._cursor_word()``. + :param params: :type params: CompletionParams :rtype: CompletionList """ - filetype = get_filetype(params.text_document.uri) - if filetype == "": - return CompletionList(False, []) text, _ = self._cursor_word( params.text_document.uri, params.position, False, r"[^$() ]" ) @@ -211,7 +196,7 @@ def completions(params: CompletionParams) -> CompletionList: ), insert_text=k, ) - for k, v in get_schema(filetype).get("properties", {}).items() + for k, v in get_schema().get("properties", {}).items() if k.startswith(text) ] return CompletionList(is_incomplete=False, items=items) diff --git a/src/autotools_language_server/utils.py b/src/make_language_server/utils.py similarity index 72% rename from src/autotools_language_server/utils.py rename to src/make_language_server/utils.py index 3ca3375..85807db 100644 --- a/src/autotools_language_server/utils.py +++ b/src/make_language_server/utils.py @@ -4,7 +4,7 @@ import json import os -from typing import Any, Literal +from typing import Any from tree_sitter.binding import Query from tree_sitter_languages import get_language @@ -40,7 +40,7 @@ def get_query(name: str, filetype: FILETYPE = "make") -> Query: return QUERIES[name] -def get_schema(filetype: FILETYPE) -> dict[str, Any]: +def get_schema(filetype: FILETYPE = "make") -> dict[str, Any]: r"""Get schema. :param filetype: @@ -58,19 +58,3 @@ def get_schema(filetype: FILETYPE) -> dict[str, Any]: with open(file) as f: SCHEMAS[filetype] = json.load(f) return SCHEMAS[filetype] - - -def get_filetype(uri: str) -> FILETYPE | Literal[""]: - r"""Get filetype. - - :param uri: - :type uri: str - :rtype: FILETYPE | Literal[""] - """ - basename = os.path.basename(uri) - ext = uri.split(os.path.extsep)[-1] - if basename == "configure.ac": - return "config" - if ext == "mk" or basename.split(os.path.extsep)[0] == "Makefile": - return "make" - return "" diff --git a/tests/test_finders.py b/tests/test_finders.py index 62d5f30..a07cf31 100644 --- a/tests/test_finders.py +++ b/tests/test_finders.py @@ -2,8 +2,8 @@ import os -from autotools_language_server.finders import DefinitionFinder from lsp_tree_sitter import UNI +from make_language_server.finders import DefinitionFinder from tree_sitter_languages import get_parser PATH = os.path.dirname(__file__) diff --git a/tests/test_utils.py b/tests/test_utils.py index 3efa845..54796ce 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -2,9 +2,9 @@ import os -from autotools_language_server.finders import DIAGNOSTICS_FINDER_CLASSES -from autotools_language_server.utils import get_filetype, get_schema from lsp_tree_sitter.diagnose import check +from make_language_server.finders import DIAGNOSTICS_FINDER_CLASSES +from make_language_server.utils import get_schema from tree_sitter_languages import get_parser PATH = os.path.dirname(__file__) @@ -23,7 +23,7 @@ def test_check() -> None: [os.path.join(PATH, "Makefile")], get_parser("make").parse, DIAGNOSTICS_FINDER_CLASSES, - get_filetype, + None, ) assert result > 0 @@ -33,5 +33,4 @@ def test_get_schema() -> None: :rtype: None """ - assert get_schema("config")["properties"].get("AC_INIT") - assert get_schema("make")["properties"].get("CURDIR") + assert get_schema()["properties"].get("CURDIR")