run mypy in the directory of the nearest pyproject.toml or mypy.ini#316
Merged
karthiknadig merged 6 commits intomicrosoft:mainfrom Sep 27, 2024
Merged
Conversation
Contributor
Author
|
@microsoft-github-policy-service agree company="Gridcog" |
8b68a2c to
2d84c25
Compare
karthiknadig
requested changes
Aug 23, 2024
Member
karthiknadig
left a comment
There was a problem hiding this comment.
Thanks for the PR. Some minor changes and suggestions.
README.md
Outdated
| <td>mypy-type-checker.cwd</td> | ||
| <td><code>${workspaceFolder}</code></td> | ||
| <td>Sets the current working directory used to lint Python files with Mypy. By default, it uses the root directory of the workspace <code>${workspaceFolder}</code>. You can set it to <code>${fileDirname}</code> to use the parent folder of the file being linted as the working directory for Mypy. | ||
| <td>Sets the current working directory used to lint Python files with Mypy. By default, it uses the root directory of the workspace <code>${workspaceFolder}</code>. You can set it to <code>${fileDirname}</code> to use the parent folder of the file being linted as the working directory for Mypy. You can also set it to <code>${filePyproject}</code> to use the folder of the nearest parent <code>pyproject.toml</code>. |
Member
There was a problem hiding this comment.
The name should likely be ${nearestConfig} since it does both pyproject and ini.
/cc @luabud
bundled/tool/lsp_server.py
Outdated
| return settings["workspaceFS"] | ||
|
|
||
| if settings["cwd"] == "${filePyproject}": | ||
| if document is None: |
Member
There was a problem hiding this comment.
we can probably move (document is None) case to the beginning of the function. Since it is common to all scenarios.
luabud
reviewed
Aug 27, 2024
3b4e9cd to
add689d
Compare
Contributor
Author
|
hey, rebased on new main, fixed fmt lint and squash a couple of fixups, but PR checks need approval again sorry |
karthiknadig
previously approved these changes
Sep 3, 2024
Member
|
hi @jwhitaker-gridcog! Thanks for the submission- could you just make sure the linting check passes? Thanks! |
Member
Contributor
Author
|
ty both, sorry i got the js fmt but missed py. also tweaked log messages. |
karthiknadig
approved these changes
Sep 3, 2024
eleanorjboyd
approved these changes
Sep 4, 2024
luabud
approved these changes
Sep 27, 2024
…ion as well Co-authored-by: Luciana Abud <45497113+luabud@users.noreply.github.com>
48070a4 to
43e8e46
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

This should fix the issues #190 and #259 .
Implements a new variable for
cwd,${filePyproject}${nearestConfig}. Ifcwdis set as such, then the lsp will search upwards from the current file for apyproject.tomlormypy.ini. If found, mypy will be run in its directory. If not found, it will run inworkspaceFolder.Questions:
that variable is ugly, should I call it something else?->${nearestConfig}mypy.ini?done)