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

Fetch config from clients in different order. #912

Closed
wants to merge 1 commit into from

Conversation

VictorCMiraldo
Copy link
Contributor

Closes #894: Fetch the basedpyright section before trying to
fetch basedpyright.analysis, since we might have received the analysis settings in the first go anyway. In fact, only ask the client for basedpyright.analysis if we haven't received in the first request.

I know zero typescript, I also don't know how to run the server to test my changes. Any advice there?

…ng to

fetch `basedpyright.analysis`, since we might have received the
`analysis` settings in the first go anyway. In fact, only ask the
client for `basedpyright.analysis` if we haven't received in the
first request.
@DetachHead
Copy link
Owner

thanks. i'll try to get around to looking at this within the next few days.

I know zero typescript, I also don't know how to run the server to test my changes. Any advice there?

the typescript/nodejs installation is managed by uv using nodejs-wheel so you don't have to install anything extra as long as you already have python installed. just run ./pw uv sync which will install all the dependencies to your venv and build the project.

the easiest way to test the language server IMO is with vscode, there's a debug config set up that will automatically launch a separate vscode instance with the extension installed:

image

if you just want to build the language server so you can run it with eglot, as long as eglot doesn't use its own bundled version of the language server, you should be able to just activate the venv and launch emacs from inside it. note that when running the language server this way will probably require you to re-install the project every time you make any changes to the code:

./pw uv sync --reinstall-package basedpyright

(i haven't tried debugging the language server this way so i can't guarantee it'll work, but i'll try to assist if you run into any issue)

you may also want to use some of the predefined scripts in package.json. you can run them inside your venv using npm run commandname eg:

npm run typecheck

see the contributing docs for more info

Copy link
Contributor

Diff from mypy_primer, showing the effect of this PR on open source code:

pydantic (https://github.com/pydantic/pydantic): 1.60x faster (35.7s -> 22.3s in a single noisy sample)

pyppeteer (https://github.com/pyppeteer/pyppeteer): 15.63x faster (13.8s -> 0.9s in a single noisy sample)

imagehash (https://github.com/JohannesBuchner/imagehash): 466.70x slower (0.0s -> 13.4s in a single noisy sample)

@VictorCMiraldo
Copy link
Contributor Author

I managed to build and use the server; I'll hopefully have time on the weekend to tinker with this a little more! 👍

@DetachHead
Copy link
Owner

hey, so i looked into this and i think i figured out a fix that should work for both vscode and eglot. see #920

would you mind testing it out and let me know if it works? thanks

@VictorCMiraldo
Copy link
Contributor Author

I'll close this PR; given we found a reliable way to configure eglot (which, btw, is the same as zed, who also requires a basedpyright.analysis-named section), I'll close this in favor of just documenting the behavior:

#935

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

document how to configure language server settings in eglot
2 participants