lapce / lapce

Lightning-fast and Powerful Code Editor written in Rust

Home Page:http://lapce.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Terminal Settings Behaviour Not as Expected - TOML Parser Issue and Start Behaviour

maddes8cht opened this issue · comments

Lapce Version:

Current nightly-cbcbca98e (05.05. 2024)

System information

Windows 10

Description:

The behaviour of the terminal settings is still not as expected. I refer to #2812, but this seems to be a different issue:
I managed to have three options (actually, it's 4, because a "default" option is added automatically, which seems to be a bug or at least inconsistent) available in the Terminal: Default Profile selection with my settings.toml looking like this:

[terminal]
font-family = "'Hack Nerd Font', 'Fira Code Nerd Font', monospace"
font-size = 0
[terminal.default-profile]
windows = "cmd"

[terminal.profiles]
cmd = { command = "C:\\Windows\\System32\\cmd.exe" }
msys = { command = "C:\\msys64\\usr\\bin\\bash.exe", args = ["--login", "-i"], env = {MSYSTEM = "MINGW64", CHERE_INVOKING = "1", MSYS2_PATH_TYPE = "inherit"}  }
Powershell = { command = "C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe"}

Problem 1: TOML parser

However, the settings break if i introduce line breaks in the argument lists, which should be allowed in proper TOML afaik.
So, if i rewrite the [terminal.profiles] section like

[terminal.profiles]
cmd = { command = "C:\\Windows\\System32\\cmd.exe" }
msys = { 
  command = "C:\\msys64\\usr\\bin\\bash.exe",
  args = ["--login", "-i"], 
  env = {MSYSTEM = "MINGW64", CHERE_INVOKING = "1", MSYS2_PATH_TYPE = "inherit"}
    }
Powershell = { command = "C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe"}

lapce behaves as if there was an empty settings.toml.
So, the TOML parser seems to be buggy.

Problem 2: Start Behaviour

Now when i have the settings.toml working as shown above, i get this in the settings interface section:
grafik

So i can select a default profile from the profiles I created.
The Terminal: profiles section is still empty, I guess this is nt an error, but still not implemented at all.
However, one would expect the Default Profile to be started by default when the first terminal is opened. This is not the case. The first Terminal that opens on Startup is always a Powershell commandline.
However, when clicking the [+] to open a new terminal, it opens the sugested Default Profile.
I found no other way to create different terminals then by switching the Terminal: Default Profile and then opening a new Terminal.

Expected behaviour:

The Default Profile should be the Profile to be started when the first terminal is opened.

Feature request:

There should be an interface selector in the terminal section itself to chose another terminal than the default to be started. I sugest a dropbox right beneath the [+] sign, which is how it's done for example in VSCode.
Maybe i should add this as a seperate feature request?

Last but not least:
Thanks a lot for all the good work!
Lapce is a very promising editor and I'm eager to watch it's further development!

So, the TOML parser seems to be buggy.

Inline tables cannot flow to next line

There should be an interface selector in the terminal section itself to chose another terminal than the default to be started

https://docs.lapce.dev/get-started/terminal

Still nothing leads to the expected behaviour that the default profile is started as the first terminal that is opened, which is always a powershell. Even after i added a default profile pointing to cmd.exe which i actually can acces with the sugested palette using < and which then opens a cmd in the terminal.
(Maybe this should be in #2812)

And still, I would sugest an additional selector right next to the [+] button.

Thanks for the fix, now it works!
the default profile now is opened in the terminal when lapce is opened.