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

LiveShare participants incorrectly opening every Clojure file as if via "Open with Notebook" #1850

Closed
pithyless opened this issue Aug 31, 2022 · 14 comments
Labels
bug Something isn't working live share notebooks

Comments

@pithyless
Copy link

TL;DR

In v2.0.292 Clojure Notebooks were introduced.

When using Calva with LiveShare the participants cannot open any Clojure files as regular files; they always open as if they chose "Open with Notebook".

Downgrading to v2.0.291 removes problem (running with VSCode 1.70.2).

Steps to reproduce:

  • Host opens Clojure project
  • Host starts LiveShare and shares link with participant
  • Participant opens link, connects to Shared system
  • Participant opens any Clojure file, either via:
    • cmd-p > find file > enter
    • cmd-p > find file > click
    • cmd-p > find file > click the icon for "open to the side"
  • Participant sees the file opened as a Clojure Notebook, not a regular Clojure file

Furthermore, after some exploration we found that if the participant opens the context menu for a .edn file in the sidebar, we see:

vscode-edn

In comparison, a .clj file has the following context-menu:

vscode-clj

Notice the distinct lack of "Open With..." for the .clj file. The host sees "Open With..." both for the .edn and .clj file.

In contrast, if the host opens a Clojure file and uses the "Focus Participants" icon, the file will open correctly as a Clojure file for the participant.

Reducing false-positives

We have tried the following so far to reduce false-positives:

  • Host disabled any other VSCode extension that may have added Notebook features, etc.
  • Participant has VSCode with minimal extensions enabled
  • Participant tried connecting via the VSCode LiveShare in a browser
  • Sharing a project without a running REPL (so even without host connecting to any REPL, we still see participants opening files always as Notebooks)

Candidates for additional tests (if necessary)

We have not yet tried:

  • REPL via jack-in (we have a multi-project monorepo and use connect-to existing REPL). But considering the issue is visible without any connected REPL, I don't think this is a primary candidate.
  • Running a sample Clojure project (we've only tried to reproduce on work projects for now)
  • Participant is logged in to LiveShare system (participants have up to now been connecting as Guests; the host is logged in)
  • Participant has some issues with multi-project monorepo and Calva gives a warning about No project-uri was specified. (I think this issue is independent, but throwing it out there just in case)

I am not sure if any of the steps that have not been tried are significant in reproducing the issue, but I mention them in case something rings a bell.

Next Steps (short-term)

We have temporarily downgraded to v2.0.291 to avoid this issue while pair programming via LiveShare.

  • Are there any ways to disable the Notebook feature while still using the newest version of Calva?
  • Can someone else reproduce and confirm this issue with LiveShare and Notebooks? Otherwise we will need to consider what other factors are contributing to this issue.

Next steps (long-term)

Hopefully fix the bug :)

PS. Thanks for all the work with Calva! ❤️

@PEZ PEZ added bug Something isn't working live share notebooks labels Aug 31, 2022
@Cyrik
Copy link
Member

Cyrik commented Aug 31, 2022

option: The editor is not automatically used when the user opens a resource, but a user can switch to the editor using the Reopen With command.

This is what we have set for notebook opening. It seems that somehow the .clj files don't have a text editor default

@svdo
Copy link
Contributor

svdo commented Sep 2, 2022

We have the same issue. Moreover, after the guest has opened a file (and hence sees it as a notebook), if the host then also opens the file then the host also sees it as a notebook.

@PEZ
Copy link
Collaborator

PEZ commented Sep 5, 2022

I've been advised that filing an issue on LiveShare might be the way to go with this one: https://github.com/MicrosoftDocs/live-share

@Cyrik
Copy link
Member

Cyrik commented Sep 5, 2022

Ah yes sorry. I looked into this and couldn't find any other extension that does it differently. It does seem to be a bug in vscode

@PEZ
Copy link
Collaborator

PEZ commented Sep 6, 2022

@pithyless @svdo does it make any difference if you configure the default editor for the workbench?

    "workbench.editorAssociations": {
        "*.clj": "default"
    },

It shouldn't matter, but bugs are a bit like bugs are...

@svdo
Copy link
Contributor

svdo commented Sep 7, 2022

@PEZ That does not seem to make a difference for me.

@svdo
Copy link
Contributor

svdo commented Sep 7, 2022

When I run the guest in the debugger in code-insiders, I see this in the window log when I open a file:

[2022-09-07 12:12:52.573] [renderer16] [critical] Extension 'ms-vsliveshare.vsliveshare' wants API proposal 'notebookWorkspaceEdit' but that proposal DOES NOT EXIST. Likely, the proposal has been finalized (check 'vscode.d.ts') or was abandoned.

And then (but that seems less serious):

[2022-09-07 12:12:54.574] [renderer16] [warning] No search provider registered for scheme: vsls, waiting
[2022-09-07 12:13:20.250] [renderer16] [error] Cannot read properties of null (reading 'fileName'): TypeError: Cannot read properties of null (reading 'fileName')
    at CoEditing.<anonymous> (/Users/me/.vscode-insiders/extensions/ms-vsliveshare.vsliveshare-1.0.5711/out/prod/agentless-extension.js:2:3002886)
    at Generator.next (<anonymous>)
    at /Users/me/.vscode-insiders/extensions/ms-vsliveshare.vsliveshare-1.0.5711/out/prod/agentless-extension.js:2:2974660
    at new Promise (<anonymous>)
    at v (/Users/me/.vscode-insiders/extensions/ms-vsliveshare.vsliveshare-1.0.5711/out/prod/agentless-extension.js:2:2974346)
    at /Users/me/.vscode-insiders/extensions/ms-vsliveshare.vsliveshare-1.0.5711/out/prod/agentless-extension.js:2:3001552
    at Array.forEach (<anonymous>)
    at CoEditing.fileServiceFilesChanged (/Users/me/.vscode-insiders/extensions/ms-vsliveshare.vsliveshare-1.0.5711/out/prod/agentless-extension.js:2:3001540)
    at /Users/me/.vscode-insiders/extensions/ms-vsliveshare.vsliveshare-1.0.5711/out/prod/agentless-extension.js:2:2985521
    at CallbackList.invoke (/Users/me/.vscode-insiders/extensions/ms-vsliveshare.vsliveshare-1.0.5711/out/prod/agentless-extension.js:2:4292962)
    at Emitter.fire (/Users/me/.vscode-insiders/extensions/ms-vsliveshare.vsliveshare-1.0.5711/out/prod/agentless-extension.js:2:4293715)
    at /Users/me/.vscode-insiders/extensions/ms-vsliveshare.vsliveshare-1.0.5711/out/prod/agentless-extension.js:2:3871266
    at handleNotification (/Users/me/.vscode-insiders/extensions/ms-vsliveshare.vsliveshare-1.0.5711/out/prod/agentless-extension.js:2:4303700)
    at processMessageQueue (/Users/me/.vscode-insiders/extensions/ms-vsliveshare.vsliveshare-1.0.5711/out/prod/agentless-extension.js:2:4303956)
    at Immediate.<anonymous> (/Users/me/.vscode-insiders/extensions/ms-vsliveshare.vsliveshare-1.0.5711/out/prod/agentless-extension.js:2:4305607)
    at processImmediate (node:internal/timers:466:21)
    at process.callbackTrampoline (node:internal/async_hooks:130:17)
[2022-09-07 12:14:14.995] [renderer16] [info] Setting search error: Unexpected end of JSON input
[2022-09-07 12:14:15.025] [renderer16] [info] Setting search error: Unexpected end of JSON input

@svdo
Copy link
Contributor

svdo commented Sep 7, 2022

@PEZ Can you maybe say more about why this should be filed at the live share repo? I'd be happy to do so, but I don't quite understand why downgrading Calva solves the issue if it's a live share issue?

@svdo
Copy link
Contributor

svdo commented Sep 7, 2022

I reported #4765 on the Live Share repo.

@Cyrik
Copy link
Member

Cyrik commented Sep 7, 2022

Downgrading Calva solves it because the earlier Calva version didn't have notebooks, so they couldn't interfere with LiveShare.
The thing about the notebook API is that we only have two possibilities to associate them with files: "option" and "default". We're already saying "option" which should mean that you have to manually open the notebook. Somehow LiveShare is not finding any other way of opening ".clj" files and is than using notebooks for them. That's why @PEZ was suggesting the EditorAssociation setting.

@Cyrik
Copy link
Member

Cyrik commented Sep 7, 2022

Oh and we cant make notebooks "more optional" because the existence of notebooks needs to be hardcoded into the projects.json file. I tried finding a way to register it dynamically so that you can disable it, but the API to do that is only in a proposed state (interestingly it's called "LiveShare" something...).

@svdo
Copy link
Contributor

svdo commented Sep 7, 2022

Just documenting: changing the notebooks setting in package.json to default does not fix the issue.

svdo added a commit to svdo/calva that referenced this issue Sep 20, 2022
This is a work-around because currently Live Share causes
clojure files to always be opened as notebooks.

See:

BetterThanTomorrow#1850
@svdo
Copy link
Contributor

svdo commented Sep 20, 2022

For people running into this issue: I created a temporary PR #1873 that changes the file name extensions used for Clojure notebooks, so that normal Clojure files are no longer opened as notebooks. The PR is automatically built by CircleCI, you can grab a vsix there and manually install it.

svdo added a commit to svdo/calva that referenced this issue Oct 6, 2022
This is a work-around because currently Live Share causes
clojure files to always be opened as notebooks.

See:

BetterThanTomorrow#1850
svdo added a commit to svdo/calva that referenced this issue Oct 12, 2022
This is a work-around because currently Live Share causes
clojure files to always be opened as notebooks.

See:

BetterThanTomorrow#1850
svdo added a commit to svdo/calva that referenced this issue Oct 21, 2022
This is a work-around because currently Live Share causes
clojure files to always be opened as notebooks.

See:

BetterThanTomorrow#1850
svdo added a commit to svdo/calva that referenced this issue Oct 27, 2022
This is a work-around because currently Live Share causes
clojure files to always be opened as notebooks.

See:

BetterThanTomorrow#1850
svdo added a commit to svdo/calva that referenced this issue Oct 27, 2022
This is a work-around because currently Live Share causes
clojure files to always be opened as notebooks.

See:

BetterThanTomorrow#1850
svdo added a commit to svdo/calva that referenced this issue Oct 27, 2022
This is a work-around because currently Live Share causes
clojure files to always be opened as notebooks.

See:

BetterThanTomorrow#1850
svdo added a commit to svdo/calva that referenced this issue Oct 27, 2022
This is a work-around because currently Live Share causes
clojure files to always be opened as notebooks.

See:

BetterThanTomorrow#1850
svdo added a commit to svdo/calva that referenced this issue Nov 3, 2022
This is a work-around because currently Live Share causes
clojure files to always be opened as notebooks.

See:

BetterThanTomorrow#1850
svdo added a commit to svdo/calva that referenced this issue Nov 7, 2022
This is a work-around because currently Live Share causes
clojure files to always be opened as notebooks.

See:

BetterThanTomorrow#1850
svdo added a commit to svdo/calva that referenced this issue Nov 10, 2022
This is a work-around because currently Live Share causes
clojure files to always be opened as notebooks.

See:

BetterThanTomorrow#1850
svdo added a commit to svdo/calva that referenced this issue Dec 6, 2022
This is a work-around because currently Live Share causes
clojure files to always be opened as notebooks.

See:

BetterThanTomorrow#1850
svdo added a commit to svdo/calva that referenced this issue Dec 22, 2022
This is a work-around because currently Live Share causes
clojure files to always be opened as notebooks.

See:

BetterThanTomorrow#1850
svdo added a commit to svdo/calva that referenced this issue Jan 9, 2023
This is a work-around because currently Live Share causes
clojure files to always be opened as notebooks.

See:

BetterThanTomorrow#1850
svdo added a commit to svdo/calva that referenced this issue Jan 23, 2023
This is a work-around because currently Live Share causes
clojure files to always be opened as notebooks.

See:

BetterThanTomorrow#1850
svdo added a commit to svdo/calva that referenced this issue Jan 25, 2023
This is a work-around because currently Live Share causes
clojure files to always be opened as notebooks.

See:

BetterThanTomorrow#1850
svdo added a commit to svdo/calva that referenced this issue Mar 17, 2023
This is a work-around because currently Live Share causes
clojure files to always be opened as notebooks.

See:

BetterThanTomorrow#1850
@PEZ
Copy link
Collaborator

PEZ commented Mar 18, 2023

We have now released Calva v2.0.340 in which we move the static declaration of which files should be associated with Calva Notebooks over to a separate extension, Calva Spritz. In theory, disabling the Calva Spritz extension should get rid of this issue for LiveShare + Calva users.

The extension can be disabled and re-enabled at will, so even if you forget to disable it before joining a LiveShare session, you should be able to fix the problem after the fact:

calva-spritz-clojure-notebooks.mp4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working live share notebooks
Projects
None yet
Development

No branches or pull requests

4 participants