It seems that this is not supported, see https://learn.microsoft.com/en-us/sql/tools/sqlcmd/edit-sqlcmd-scripts-query-editor?view=sql-server-ver16.
I agree that this is a surprising shortcoming. You can file a request for an enhancement at https://developercommunity.visualstudio.com/SSMS