onivim / oni

Oni: Modern Modal Editing - powered by Neovim
https://www.onivim.io
MIT License
11.36k stars 301 forks source link

Language server suddenly changed the language type from go to c# #1846

Open saibing opened 6 years ago

saibing commented 6 years ago

golangserver

akinsho commented 6 years ago

@saibing thanks for logging this issue I've also seen this happen while working in reason files tbh I had no idea a csproj file was for c# so I didnt realise it wasn't reason related. I'm not sure if some legacy code from when oni-plugin-csharp might be being triggered.

To clarify do you have the oni-plugin-csharp plugin installed?

saibing commented 6 years ago

@Akin909

There is no oni-plugin-csharp in my oni extensions directory:

bingo@bingo-huawei oni (master) $ tree extensions/
extensions/
├── css
│   └── syntaxes
│       └── css.tmLanguage.json
├── go
│   ├── README.md
│   └── syntaxes
│       └── go.json
├── html
│   ├── package.json
│   └── snippets
│       └── html.json
├── images
│   └── package.json
├── javascript
│   ├── package.json
│   ├── snippets
│   │   └── javascript.json
│   └── syntaxes
│       ├── JavaScriptReact.tmLanguage.json
│       └── JavaScript.tmLanguage.json
├── less
│   └── syntaxes
│       └── less.tmLanguage.json
├── oni-plugin-markdown-preview
│   ├── lib
│   │   ├── index.d.ts
│   │   ├── index.js
│   │   └── index.js.map
│   ├── package.json
│   ├── package-lock.json
│   ├── src
│   │   └── index.tsx
│   └── tsconfig.json
├── README.md
├── reason
│   ├── package.json
│   ├── README.md
│   ├── snippets
│   │   └── reason.json
│   └── syntaxes
│       └── reason.json
├── scss
│   └── syntaxes
│       └── scss.json
├── theme-icons-seti
│   ├── icons
│   │   ├── seti-icon-theme.json
│   │   └── seti.woff
│   ├── package.json
│   ├── README.md
│   └── thirdpartynotices.txt
├── theme-nord
│   ├── colors
│   │   ├── nord.json
│   │   └── nord.vim
│   ├── package.json
│   └── README.md
├── theme-onedark
│   ├── colors
│   │   ├── onedark.json
│   │   └── onedark.vim
│   └── package.json
├── theme-solarized
│   ├── colors
│   │   ├── solarized8_dark.json
│   │   ├── solarized8_dark.vim
│   │   ├── solarized8_light.json
│   │   ├── solarized8_light.vim
│   │   └── solarized8.vim
│   └── package.json
└── typescript
    ├── package.json
    ├── snippets
    │   └── typescript.json
    └── syntaxes
        ├── TypeScriptReact.tmLanguage.json
        └── TypeScript.tmLanguage.json

31 directories, 46 files
bingo@bingo-huawei oni (master) $
saibing commented 6 years ago

@Akin909 My config.tsx content as follow:

import * as React from "/data/saibing/git/ts/oni/node_modules/react"
import * as Oni from "/data/saibing/git/ts/oni/node_modules/oni-api"

export const activate = (oni: Oni.Plugin.Api) => {
    console.log("config activated")

    // Input
    //
    // Add input bindings here:
    //
    oni.input.bind("<c-enter>", () => console.log("Control+Enter was pressed"))
    oni.input.bind("<s-c-r>", "oni.editor.findAllReferences")
    oni.input.bind("<s-insert>", "editor.clipboard.paste")
    oni.input.unbind("<c-g>") // make c-g work as expected in vim
    oni.input.bind("<s-c-g>", () => oni.commands.executeCommand("sneak.show"))
    //oni.input.bind("<c-]", "oni.editor.gotoDefinition")

    //
    // Or remove the default bindings here by uncommenting the below line:
    //
    // oni.input.unbind("<c-p>")

}

export const deactivate = (oni: Oni.Plugin.Api) => {
    console.log("config deactivated")
}

export const configuration = {
    //add custom config here, such as

    "ui.colorscheme": "nord",

    "oni.hideMenu": true,
    "oni.useDefaultConfig": true,
    "oni.bookmarks": ["~/Documents"],
    "oni.loadInitVim": true,
    "editor.quickOpen.filterStrategy": "regex",
    //"editor.fontSize": "12px",
    //"editor.fontFamily": "Monaco",

    // UI customizations
    "ui.animations.enabled": true,
    "ui.fontSmoothing": "auto",
    "editor.fontFamily": "Source Code Pro",
    "editor.fontSize": "14px",

    "language.c.languageServer.command": "cquery",
    "language.c.languageServer.rootFiles": [".git"],
    "language.c.languageServer.arguments": ["--init", '{"cacheDirectory": "/tmp/oni_cquery"}'],

    "language.cpp.languageServer.command": "cquery",
    "language.cpp.languageServer.rootFiles": [".git"],
    "language.cpp.languageServer.arguments": ["--init", '{"cacheDirectory": "/tmp/oni_cquery"}'],

    "language.go.languageServer.rootFiles": [".git"],
    "language.go.languageServer.arguments": ["--logfile", "goserver.log", "--trace", "--gocodecompletion"],

    "language.python.languageServer.command": "pyls",
    "language.python.languageServer.rootFiles": [".git"],

    "language.java.languageServer.command": "javaserver.sh",   
    "language.java.languageServer.rootFiles": [".git"],

    "experimental.markdownPreview.enabled": true
}
saibing commented 6 years ago

@Akin909 If I create .git directory in $GOROOT/src, Oni will work well.

tmandry commented 6 years ago

I believe this is just a wrong error message:

https://github.com/onivim/oni/blob/3f2fe46de64586c62b11b9d1f90fb37e07b86a5b/browser/src/Utility.ts#L128-L134

The "csproj" is hard coded, but this appears to be a general utility.

akinsho commented 6 years ago

Thanks for catching that @tmandry, think its probably a very old remnant of having the csharp oni plugin though it predates me, but at least that explains things and we can look at fixing that 👍