Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Formatting output is not as expected #34

Open
jrock2004 opened this issue Oct 16, 2019 · 5 comments
Open

Formatting output is not as expected #34

jrock2004 opened this issue Oct 16, 2019 · 5 comments
Labels
question Further information is requested

Comments

@jrock2004
Copy link

jrock2004 commented Oct 16, 2019

So I am trying to use this addon and I did a test to compare how it looks in VScode vs vim. Now maybe VScode is wrong but thought I would ask. So I typed the following:

if(1===1){

When I hit enter it was formatted to

if(1===1) {

}

If I do the same example in VScode I get

if (1 === 1) {

}

Notice how it added the space around the triple equal and between the if and (?

Here is my .prettierrc

{
  "bracketSpacing": true,
  "singleQuote": true,
  "trailingComma": "es5"
}

My project does have an .editorconfig

@chemzqm chemzqm added the question Further information is requested label Oct 16, 2019
@chemzqm
Copy link
Member

chemzqm commented Oct 16, 2019

You need check https://github.com/neoclide/coc.nvim/wiki/Debug-language-server#using-output-channel to make sure it's not formatted by other plugin like coc-tsserver

@jrock2004
Copy link
Author

jrock2004 commented Oct 16, 2019

Hmmm, so it seems like now its not even formatting for me. This is my coc-settings

{
  "suggest.enablePreview": true,
  "codeLens.enable": true,
  "git.addedSign.text": "┃",
  "git.removedSign.text": "┃",
  "git.changedSign.text": "┃",
  "git.changeRemovedSign.text": "┃",
  "suggest.maxPreviewWidth": 100,
  "diagnostic.checkCurrentLine": true,
  "diagnostic.maxWindowHeight": 20,
  "diagnostic.errorSign": "✖",
  "diagnostic.warningSign": "⚠",
  "diagnostic.infoSign": "●",
  "diagnostic.hintSign": "○",
  "coc.preferences.currentFunctionSymbolAutoUpdate": true,
  "git.addGlameToBufferVar": true,
  "prettier.requireConfig": true,
  "emmet.includeLanguages": {
    "html.handlebars": "html",
    "javascript": "javascriptreact"
  },
  "coc.preferences.formatOnType": true,
  "tailwindCSS.htmlLanguages": [
    "blade",
    "edge",
    "eelixir",
    "ejs",
    "elixir",
    "erb",
    "eruby",
    "haml",
    "handlebars",
    "html",
    "HTML (EEx)",
    "HTML (Eex)",
    "html.twig",
    "html.handlebars",
    "jade",
    "leaf",
    "markdown",
    "njk",
    "nunjucks",
    "php",
    "razor",
    "slim",
    "svelte",
    "twig",
    "vue"
  ]
}

If I highlight the text and run formatter it formats it correctly. So maybe on type is not supported?

@jrock2004
Copy link
Author

@chemzqm if I do echo coc#status() it says Prettier TSC. Is that correct?

@jrock2004
Copy link
Author

I wonder if format on type is using something different then when I grab a selection and format it

command! -nargs=0 Prettier :CocCommand prettier.formatFile
nmap <leader>f :CocCommand prettier.formatFile<cr>
vmap <leader>f <Plug>(coc-format-selected)

@rgreenblatt
Copy link

I wonder if format on type is using something different then when I grab a selection and format it

command! -nargs=0 Prettier :CocCommand prettier.formatFile
nmap <leader>f :CocCommand prettier.formatFile<cr>
vmap <leader>f <Plug>(coc-format-selected)

Possibly related to #37? I am running into an issue where a different formater is used for a section vs format all (for json). According to that issue, the problem is fixed on master.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants