Closed jpa95 closed 12 months ago
@jpa95 The objectscript.multilineMethodArgs
setting is just passed along to the server as a query parameter to a REST request that gets the document's text. The server adds the tabs when it renders the class definition as text. We can't tell the server to add spaces or a different number of tabs. If there's a VS Code command that applies the indentation settings then we could possibly run that command automatically after fetching the document contents, but I think that's the best we could do.
@isc-bsaviano Well there is a command named "convert indentation to spaces/tab", but you still would have to check the user's setting configuration. I'm pretty sure it's the formatter extension's responsibility to do so.
I'm gonna go out on a limb and say that for other languages we are using the Prettier extension for code formatting -- i'd love to have an ObjectScript plugin for that. :)
@jpa95 Now that I think about it more, I think it's too heavy-handed to call the indentation command just to convert these tabs to spaces. IMO the ideal workflow would be for the user to manually format the entire document whenever they need to (or set up auto-formatting via the VS Code settings). Right now our formatter doesn't touch indentation, but there's a request for us to add that (https://github.com/intersystems/language-server/issues/293). I think I should close this issue and consider it another request for that same feature. As for having an ObjectScript plugin to Prettier, it may be possible but we would need to generate an AST. AFAIK nobody has ever been able to do this for ObjectScript.
@isc-bsaviano Sounds good to me. I also agree the user should decide if and when to format, and how.
When setting
"objectscript.multilineMethodArgs": true
, the code formatting puts function parameters on separate lines which is fine; however it always uses tabs to indent said parameters, regardless of the editor.insertSpaces configuration.I would like the
objectscript.multilineMethodArgs
to take into accounteditor.insertSpaces
, and when"editor.insertSpaces": true,
, it should uses spaces instead of tabs, and also respecteditor.tabSize
as well.Thanks for your time!