Skip to content

Commit

Permalink
Fix for assert that was triggered when a loose python file was open w… (
Browse files Browse the repository at this point in the history
#8067)

pylance will use a default workspace
  • Loading branch information
bschnurr authored Nov 13, 2024
1 parent 8155e6e commit 1c06c37
Showing 1 changed file with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -566,11 +566,12 @@ private Tuple<StreamData, bool> OnSendToServer(StreamData data) {
capabilities["workspace"]["configuration"] = true;

var folders = GetFolders();
Debug.Assert(folders.Any(), "no workspace or projects found");
messageParams["workspaceFolders"] = JToken.FromObject(folders.ToArray());
_sentInitialWorkspaceFolders = true;
_workspaceFoldersSupported = true;

if (folders.Any()) {
messageParams["workspaceFolders"] = JToken.FromObject(folders.ToArray());
_sentInitialWorkspaceFolders = true;
_workspaceFoldersSupported = true;
}

// Root path and root URI should not be sent. They're deprecated and will
// just confuse pylance with respect to what is the root folder.
// https://microsoft.github.io/language-server-protocol/specifications/specification-current/#initialize
Expand Down

0 comments on commit 1c06c37

Please sign in to comment.