Git Product home page Git Product logo

Comments (12)

glepnir avatar glepnir commented on June 15, 2024

@Cyberlane did you set the lsp for go?

from thinkvim.

Cyberlane avatar Cyberlane commented on June 15, 2024

As I said, I'm new to go... so I have no idea what that is.

I have done brew install go, set that environment variable and then tried to follow a tutorial for a simple app to go familiar with the language.

from thinkvim.

glepnir avatar glepnir commented on June 15, 2024

you should add the gopls into the coc-settings.jsonlike

 "languageserver": {
    "golang": {
      "command": "gopls",
      "rootPatterns": ["go.mod", ".vim/", ".git/", ".hg/"],
      "filetypes": ["go"]
    }
  }

then you need install the gopls

from thinkvim.

glepnir avatar glepnir commented on June 15, 2024

more about the gopls you should check this link https://github.com/golang/go/wiki/gopls

from thinkvim.

Cyberlane avatar Cyberlane commented on June 15, 2024

Ah, I assumed all of the coc-settings.json were pre-configured for both Go and JS :)

I will add that now, and install gopls and see how it goes...

from thinkvim.

glepnir avatar glepnir commented on June 15, 2024

maybe you should to know coc.and how to work, the coc-settings.json like vscode settings.json. you can add any language lsp into the coc-settings.json like c go c++ and so on .the js server is coc-tsserver which coc provide it .

this is coc github https://github.com/neoclide/coc.nvim

check this link about lsp. what is lsp

and this my coc-settings.json .

{
    "suggest.triggerAfterInsertEnter": false,
    "suggest.timeout": 500,
    "suggest.noselect": false,
    "suggest.detailField":"abbr",
    "suggest.snippetIndicator": "🌟",
    "suggest.triggerCompletionWait": 100,
    "suggest.echodocSupport": true,
    "suggest.completionItemKindLabels": {
        "keyword": "\uf1de",
        "variable": "\ue79b",
        "value": "\uf89f",
        "operator": "\u03a8",
        "function": "\u2A15",
        "reference": "\ufa46",
        "constant": "\uf8fe",
        "method": "\uf09a",
        "struct": "\ufb44",
        "class": "\uf0e8",
        "interface": "\uf417",
        "text": "\u2663",
        "enum": "\uf435",
        "enumMember": "\uf02b",
        "module": "\uf530",
        "color": "\ue22b",
        "property": "\ue624",
        "field": "\uf6a6",
        "unit": "\uf475",
        "event": "\ufacd",
        "file": "\uf723",
        "folder": "\uf114",
        "snippet": "\ue60b",
        "typeParameter": "\uf728",
        "default": "\uf29c"
    },
    //diagnostic
    "diagnostic.signOffset": 9999999,
	"diagnostic.errorSign": "●",
	"diagnostic.warningSign": "●",
    "diagnostic.displayByAle": false,
    "diagnostic.refreshOnInsertMode": true,
    //git
    "git.enableGutters": true,
    "git.addGlameToBufferVar": true,
    "git.addGlameToVirtualText": true,
    "git.virtualTextPrefix": " ❯❯❯ ",
    "git.addedSign.hlGroup": "GitGutterAdd",
    "git.changedSign.hlGroup": "GitGutterChange",
    "git.removedSign.hlGroup": "GitGutterDelete",
    "git.topRemovedSign.hlGroup": "GitGutterDelete",
    "git.changeRemovedSign.hlGroup": "GitGutterChangeDelete",
    "git.addedSign.text":"▎",
    "git.changedSign.text":"▎",
    "git.removedSign.text":"▏",
    "git.topRemovedSign.text": "▔",
    "git.changeRemovedSign.text": "▋",
    //Snippet
    "coc.preferences.snippetStatusText": "Ⓢ ",
    //tslint
    "tslint.autoFixOnSave": true,
    //prettier
    "coc.preferences.formatOnSaveFiletypes": ["css","markdown"],
    "prettier.statusItemText": "ⓟ ",
    "prettier.eslintIntegration": true,
    "prettier.tslintIntegration": true,
    "prettier.stylelintIntegration": true,
    //emmet
    "emmet.includeLanguages": {"vue-html": "html", "javascript": "javascriptreact"},
    //python
    "python.autoComplete.addBrackets": true,
    // eslint
    "eslint.filetypes": ["javascript", "javascript.jsx", "javascriptreact"],
    "eslint.autoFix": true,
    "eslint.autoFixOnSave": true,
    //golang
    "languageserver": {
            "golang": {
                "command": "gopls",
                "rootPatterns": ["go.mod", ".vim/", ".git/", ".hg/"],
                "filetypes": [
                    "go"
                ]
            },
        "dockerfile": {
                "command": "docker-langserver",
                "filetypes": [
                    "dockerfile"
                ],
                "args": [
                    "--stdio"
                ]
            },
            "efm": {
                "command": "efm-langserver",
                "args": [],
                "filetypes": [
                    "vim",
                    "markdown"
                ]
            }
        }
}

from thinkvim.

Cyberlane avatar Cyberlane commented on June 15, 2024

I briefly started to use CoC about a month ago, prior to that I was using:

Plug 'pangloss/vim-javascript'
Plug 'mxw/vim-jsx'

and prior to that I was using YouCompleteMe, but it was so slow, so I stopped using it.
I do understand what a language server is in the context of VIM (although, I honestly am not used to seeing it abbreviated to lsp), so I had assumed you meant it was something specific to Golang :)

It's up and working now, the only errors I get are from gopls, thanks for the help! :)

from thinkvim.

glepnir avatar glepnir commented on June 15, 2024

vim-jsx-imporve better than that plugins. i have add some feature into this plugin. gopls has som problem .its not stable . gopls has developing.

from thinkvim.

Cyberlane avatar Cyberlane commented on June 15, 2024

@taigacute I just noticed that when I do indent in Go files, it does tabs instead of spaces. If I do indent in a JS file, it does spaces just fine.

Is there a per-language setting I am missing? I assumed the following were enough:

set tabstop=2
set shiftwidth=2
set expandtab

from thinkvim.

glepnir avatar glepnir commented on June 15, 2024

cause go code indented with tabs . it not support space. i have set https://github.com/taigacute/ThinkVim/blob/master/after/ftplugin/go.vim

from thinkvim.

Cyberlane avatar Cyberlane commented on June 15, 2024

Ah... I assumed it would be like C and not care so much. Thanks for the info!

from thinkvim.

glepnir avatar glepnir commented on June 15, 2024

i use this plugin for https://github.com/Yggdroot/indentLine for indented. but this plugin doesnt support the code with tabs.

from thinkvim.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.