halfbrained / cuda_lsp

LSP Client plugin for CudaText
6 stars 4 forks source link

document formatting? #54

Closed Alexey-T closed 3 years ago

Alexey-T commented 3 years ago

Пи сервер умеет так- Document Formatting: https://raw.githubusercontent.com/palantir/python-language-server/develop/resources/document-format.gif

можем сделать?

halfbrained commented 3 years ago

можем, даже опции почти все есть

/**
* Size of a tab in spaces.
*/
tabSize: uinteger;

/**
* Prefer spaces over tabs.
*/
insertSpaces: boolean;

/**
* Trim trailing whitespace on a line.
*/
trimTrailingWhitespace?: boolean;

/**
* Insert a newline character at the end of the file if one does not exist.
*/
insertFinalNewline?: boolean;

/**
* Trim all newlines after the final newline at the end of the file.
*/
trimFinalNewlines?: boolean;

insertFinalNewline - у CudaText нету?

Alexey-T commented 3 years ago

это ненужные опции,давайте зададим trimTrailingWhitespace on insertFinalNewline on trimFinalNewlines on

halfbrained commented 3 years ago

Кроме insertFinalNewline, я думал брать опции из Editor.get_prop, есть причина этого не делать?

(Использовать опции юзера же должно быть предпочтительно?)

  • Size of a tab in spaces. -- PROP_TAB_SIZE
  • Prefer spaces over tabs. -- PROP_TAB_SPACES
  • Trim trailing whitespace on a line. -- PROP_SAVING_TRIM_SPACES
  • Trim all newlines after the final newline at the end of the file. -- PROP_SAVING_TRIM_FINAL_EMPTY_LINES
Alexey-T commented 3 years ago

да, согласен, лучше брать PROP_

Alexey-T commented 3 years ago

и еще PROP_SAVING_FORCE_FINAL_EOL

halfbrained commented 3 years ago

сделал document formatting

посмотрел, pyls поддерживает и range formatting, наверное тоже пригодится

Alexey-T commented 3 years ago

спасибо. :)

halfbrained commented 3 years ago

добавил и range formatting