satiromarra / vscode-sftp

Super fast sftp/ftp extension for VS Code
Other
23 stars 3 forks source link

sftp.json: Expected double-quoted property name in JSON #76

Closed evtimov closed 1 year ago

evtimov commented 1 year ago

After enabling comments in JSON files (JSON with Comments) in user settings file (settings.json)

"files.associations": {
    "*.json": "jsonc"
}

It is not possible to add comments in sftp.json. Is there a way sftp.json to respect any comments added?

Here is the log file:

[2023-07-28 18:40:20] [error] SyntaxError: g:\.vscode\sftp.json: Expected double-quoted property name in JSON at position 1015
    at JSON.parse (<anonymous>)
    at Object.<anonymous> (c:\Users\info\.vscode\extensions\satiromarra.code-sftp-1.18.1\dist\extension.js:2:250995) 

image

Gracias Satiro.

satiromarra commented 1 year ago

Hi @evtimov

Due to the tests I have been doing, that configuration in settings.json only works with the default profile.

You will need to go to the configuration editor interface, search for files.associations and from there add an element "*.json" with a value "jsonc".

evtimov commented 1 year ago

Hi Satiro,

CTRL+SHIFT+P

defaultSettings.json (Open Default Settings JSON) is readonly and can't be modified.

image

So, I added these to settings.json (Open User Settings JSON) as below.

image

    "files.associations": {
        "*.json": "jsonc"
    }

I have these in the UI configuration editor interface too:

image

What am I doing wrong? The error occurs when I try to save .vscode/sftp.json

[2023-08-01 17:28:05] [error] SyntaxError: g:\.vscode\sftp.json: Expected double-quoted property name in JSON at position 491
    at JSON.parse (<anonymous>)
    at Object.<anonymous> (c:\Users\info\.vscode\extensions\satiromarra.code-sftp-1.18.1\dist\extension.js:2:250995) 
satiromarra commented 1 year ago

Hi @evtimov

Mea culpa, I have only verified that it allowed me to comment on lines and not that the extension recognised them.

The extension has a schema to validate the sftp.json file and it seems that the standard does not allow comments.

Buuuut it seems that it allows a false comment type "//username": "user" instead of "username": "user"

evtimov commented 1 year ago

Ah yes, but my idea was to use it like that :)) Anyway, thank you for checking! You can close this issue 👍 Muchas gracias!

image