This is an automated email from the ASF dual-hosted git repository.

sdedic pushed a commit to branch vsnetbeans_2003
in repository https://gitbox.apache.org/repos/asf/netbeans.git


The following commit(s) were added to refs/heads/vsnetbeans_2003 by this push:
     new 2fb03d6ccf Work on documents, not on editors. Translate filenames on 
Windows
2fb03d6ccf is described below

commit 2fb03d6ccf775da515fd128f05d252a5e434d3eb
Author: Svata Dedic <[email protected]>
AuthorDate: Wed Jan 10 10:09:51 2024 +0100

    Work on documents, not on editors. Translate filenames on Windows
---
 java/java.lsp.server/vscode/src/extension.ts | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/java/java.lsp.server/vscode/src/extension.ts 
b/java/java.lsp.server/vscode/src/extension.ts
index 841a95c070..d743950e54 100644
--- a/java/java.lsp.server/vscode/src/extension.ts
+++ b/java/java.lsp.server/vscode/src/extension.ts
@@ -1063,12 +1063,20 @@ function doActivateWithJDK(specifiedJDK: string | null, 
context: ExtensionContex
                 runConfigurationUpdateAll();
             });
             c.onRequest(SaveDocumentsRequest.type, async (request : 
SaveDocumentRequestParams) => {
-                for (let ed of window.visibleTextEditors) {
-                    if 
(request.documents.includes(ed.document.uri.toString())) {
-                        await 
vscode.commands.executeCommand('workbench.action.files.save', ed.document.uri);
+                const uriList = request.documents.map(s => {
+                    let re = /^file:\/(?:\/\/)?([A-Za-z]):\/(.*)$/.exec(s);
+                    if (!re) {
+                        return s;
+                    }
+                    // don't ask why vscode mangles URIs this way; in 
addition, it uses lowercase drive letter ???
+                    return `file:///${re[1].toLowerCase()}%3A/${re[2]}`;
+                });
+                for (let ed of workspace.textDocuments) {
+                    if (uriList.includes(ed.uri.toString())) {
+                        return ed.save();
                     }
                 }
-                return true;
+                return false;
             });
             c.onRequest(InputBoxRequest.type, async param => {
                 return await window.showInputBox({ title: param.title, prompt: 
param.prompt, value: param.value, password: param.password });


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists

Reply via email to