Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Depend on python-lsp-server #2

Merged
merged 5 commits into from
May 18, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ Mypy plugin for PYLS
.. image:: https://github.com/Richardk2n/pyls-mypy/workflows/Python%20package/badge.svg?branch=master
:target: https://github.com/Richardk2n/pyls-mypy/

This is a plugin for the Palantir's Python Language Server (https://github.com/palantir/python-language-server)
This is a plugin for the [Python LSP Server](https://github.com/python-lsp/python-lsp-server).

It, like mypy, requires Python 3.6 or newer.


Installation
------------

Install into the same virtualenv as pyls itself.
Install into the same virtualenv as python-lsp-server itself.

``pip install mypy-ls``

Expand All @@ -31,7 +31,7 @@ Depending on your editor, the configuration (found in a file called mypy-ls.cfg
::

{
"enabled": True,
"live_mode": True,
"strict": False
"enabled": True,
"live_mode": True,
"strict": False
}
18 changes: 9 additions & 9 deletions mypy_ls/plugin.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
"""
File that contains the pyls plugin mypy-ls.
File that contains the python-lsp-server plugin mypy-ls.

Created on Fri Jul 10 09:53:57 2020

Expand All @@ -12,9 +12,9 @@
import os.path
import logging
from mypy import api as mypy_api
from pyls import hookimpl
from pyls.workspace import Document, Workspace
from pyls.config.config import Config
from pylsp import hookimpl
from pylsp.workspace import Document, Workspace
from pylsp.config.config import Config
from typing import Optional, Dict, Any, IO, List
import atexit

Expand Down Expand Up @@ -88,17 +88,17 @@ def parse_line(line: str, document: Optional[Document] = None) -> Optional[Dict[


@hookimpl
def pyls_lint(config: Config, workspace: Workspace, document: Document,
def pylsp_lint(config: Config, workspace: Workspace, document: Document,
is_saved: bool) -> List[Dict[str, Any]]:
"""
Lints.

Parameters
----------
config : Config
The pyls config.
The pylsp config.
workspace : Workspace
The pyls workspace.
The pylsp workspace.
document : Document
The document to be linted.
is_saved : bool
Expand Down Expand Up @@ -144,14 +144,14 @@ def pyls_lint(config: Config, workspace: Workspace, document: Document,


@hookimpl
def pyls_settings(config: Config) -> Dict[str, Dict[str, Dict[str, str]]]:
def pylsp_settings(config: Config) -> Dict[str, Dict[str, Dict[str, str]]]:
"""
Read the settings.

Parameters
----------
config : Config
The pyls config.
The pylsp config.

Returns
-------
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
python-language-server>=0.34.0
python-lsp-server
mypy
8 changes: 4 additions & 4 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[metadata]
name = mypy-ls
author = Tom van Ommeren, Richard Kellnberger
description = Mypy linter for the Python Language Server
description = Mypy linter for the Python LSP Server
url = https://github.com/Richardk2n/pyls-mypy
long_description = file: README.rst
license='MIT'
Expand All @@ -17,13 +17,13 @@ classifiers =
[options]
python_requires = >= 3.6
packages = find:
install_requires =
python-language-server>=0.34.0
install_requires =
python-lsp-server
mypy


[options.entry_points]
pyls = mypy_ls = mypy_ls.plugin
pylsp = mypy_ls = mypy_ls.plugin

[options.extras_require]
test =
Expand Down
12 changes: 6 additions & 6 deletions test/test_plugin.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import pytest

from pyls.workspace import Workspace, Document
from pyls.config.config import Config
from pyls import uris
from pylsp.workspace import Workspace, Document
from pylsp.config.config import Config
from pylsp import uris
from mock import Mock
from mypy_ls import plugin

Expand Down Expand Up @@ -37,16 +37,16 @@ def plugin_settings(self, plugin, document_path=None):

def test_settings():
config = FakeConfig()
settings = plugin.pyls_settings(config)
settings = plugin.pylsp_settings(config)
assert settings == {"plugins": {"mypy-ls": {}}}


def test_plugin(workspace):
config = FakeConfig()
doc = Document(DOC_URI, workspace, DOC_TYPE_ERR)
workspace = None
plugin.pyls_settings(config)
diags = plugin.pyls_lint(config, workspace, doc, is_saved=False)
plugin.pylsp_settings(config)
diags = plugin.pylsp_lint(config, workspace, doc, is_saved=False)

assert len(diags) == 1
diag = diags[0]
Expand Down