theia icon indicating copy to clipboard operation
theia copied to clipboard

Fix programmatic save for custom text editors

Open msujew opened this issue 1 year ago • 0 comments

What it does

Closes https://github.com/eclipse-theia/theia/issues/9230

Instead of using the EditorManager (that seemingly doesn't keep track of CustomEditorWidget instances), we simply use the monaco model service to save the underlying model.

Also removes an unused RPC method $tryCloseDocument.

How to test

Follow the instructions in https://github.com/eclipse-theia/theia/issues/9230 and confirm that manual saving works as expected. Alternatively, the extension in https://github.com/eclipse-theia/theia/issues/12979 should now also work as expected.

Review checklist

Reminder for reviewers

msujew avatar May 05 '24 22:05 msujew

Yes, wholheartedly agree, I am also stuck with CtrlSpace but the binary picker is by now dispensable, since Vim seems to have it built-in. Maybe @girishji 's https://github.com/girishji/scope.vim/ gives an idea. Maybe https://github.com/yehuohan/popc serves you well in the meanwhile, I didn't come around to trying it out, yet

Konfekt avatar Mar 22 '24 16:03 Konfekt

@Konfekt Thanks for pointing me to the right plugins. I'm not very used to configuring Neovim (specifically Lazyvim), so I couldn't delve much into Scope.vim myself. However, as you said, Popc does an amazing job, and now I can use CtrlSpace in a floating window. Thanks so much!

One problem that's newly introduced by using Popc is that now I see the following error when I launch LazyVim:

Error detected while processing function ctrlspace#keys#Keypressed[14]..ctrlspace#keys#workspace#LoadOrSave[2]..<SNR>23_loadWorkspace[32]..ctrlspace#workspaces#LoadWorkspace[62]..<SNR>70_execWorkspaceCommands[26]..TabClosed Autocommands for "*"..function <SNR>31_tabCallback:
line   22:
E516: No buffers were deleted: noautocmd bdelete! 1
E516: No buffers were deleted: noautocmd bdelete! 4

This error occurs only when I turn on Popc. The error disappears if I turn off (mute) Popc. Somehow, the functions in CtrlSpace seem to have been affected by Popc.

I configured both CtrlSpace and Popc using Lazy.nvim, which uses lua script.

swoh816 avatar Mar 23 '24 01:03 swoh816

There are two more problems to use Popc with CtrlSpace:

  1. Popc restores tabline, so that tabline appear at the top even though I set vim.opt.showtabline = 0.
  2. PopcBuffer correctly shows only buffers, not bookmarks, tabs, workspaces. It says Nothing to pop for everything else than buffers.

swoh816 avatar Mar 23 '24 01:03 swoh816

Error detected while processing function ctrlspace#keys#Keypressed[14]..ctrlspace#keys#workspace#LoadOrSave[2]..<SNR>23_loadWorkspace[32]..ctrlspace#workspaces#LoadWorkspace[62]..<SNR>70_execWorkspaceCommands[26]..TabClosed Autocommands for "*"..function <SNR>31_tabCallback:

This is best asked at https://github.com/yehuohan/popc/issues but it is likely that as a fork there are competing autocmds

Regarding 2., maybe layers are the answer

Konfekt avatar Mar 23 '24 07:03 Konfekt