microsoft / microsoft/multilspy

`start_server` context manager not idempotent

Open
#101 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
610
Forks
111
PR merge metrics
No merged PRs in 30d

Description

The below is adapted from the Rust tests. I expect both printouts to be identical, but the second prints None.

from multilspy.multilspy_config import MultilspyConfig
from multilspy.multilspy_logger import MultilspyLogger
from multilspy.multilspy_utils import FileUtils
from multilspy import SyncLanguageServer
from tempfile import TemporaryDirectory
import os
from pathlib import Path, PurePath

params = {
    "code_language": "rust",
    "repo_url": "https://github.com/fathyb/carbonyl/",
    "repo_commit": "ab80a276b1bd1c2c8dcefc8f248415dfc61dc2bf",
}
config = MultilspyConfig.from_dict(params)
logger = MultilspyLogger()

with TemporaryDirectory() as temp_dir:
    repo_zip_url = params["repo_url"] + f"archive/{params['repo_commit']}.zip"
    FileUtils.download_and_extract_archive(logger, repo_zip_url, temp_dir, "zip")
    dir_contents = os.listdir(temp_dir)
    assert len(dir_contents) == 1
    source_directory_path = str(Path(temp_dir, dir_contents[0]))
    lsp = SyncLanguageServer.create(config, logger, source_directory_path)
    with lsp.start_server():
        print(
            "FIRST RESULT",
            lsp.request_hover(str(PurePath("src/browser/bridge.rs")), 132, 18),
        )
    with lsp.start_server():
        print(
            "SECOND RESULT",
            lsp.request_hover(str(PurePath("src/browser/bridge.rs")), 132, 18),
        )

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with SyncLanguageServer.start_server and the reproduction in tests/multilspy/test_multilspy_rust.py. Run the provided example and inspect the repeated request_hover calls across both context-manager uses. Done means both printouts return identical results instead of the second returning None.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, rust
Domain
devtools
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.