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

Add "document-before-save-as" signal #3572

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

techee
Copy link
Member

@techee techee commented Oct 4, 2023

Right now only the "document-save" is fired when performing "save as" which lacks the information about the original file name (which, for instance, is necessary for the LSP client where it needs to notify the server that the "old" document was closed and the document under the new name opened).

Right now the plugin at https://github.com/techee/geany-lsp has the code using this signal commented-out - I'll uncomment it once it's added to Geany (so renaming a file might cause problems synchronizing the document with the server with the current implementation).

@techee techee added the lsp Related to LSP API and plugins label Oct 4, 2023
*
* @since TODO
*/
signal void (*document_before_save_as)(GObject *obj, GeanyDocument *doc, gpointer user_data);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps add a boolean return value to potentially allow the plugin to block saving the file?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, I'm not sure if plugins should be allowed to do that and what exactly would this be good for. Do you have some example?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, the plugin should not block a user saving a file, under any circumstances.

@elextr
Copy link
Member

elextr commented Nov 3, 2023

Looks ok to me but I know nothing about GTK objects, but it looks the same as document_before_save :-)

@techee techee added this to the 2.1 milestone Apr 29, 2024
Right now only the "document-save" is fired when performing "save as"
which lacks the information about the original file name (which, for
instance, is necessary for the LSP client where it needs to notify
the server that the "old" document was closed and the document under
the new name opened).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lsp Related to LSP API and plugins
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants