コード例 #1
0
ファイル: plugin.py プロジェクト: alecmev/LSP-julia
    def __init__(self):
        if sublime.platform == "windows":
            command = [
                "julia", "--startup-file=no", "--history-file=no", "-e",
                "using LanguageServer;" +
                "server = LanguageServer.LanguageServerInstance(STDIN, STDOUT, false);"
                + "run(server);"
            ]
        else:
            command = [
                "bash",
                os.path.join(julia_pkg_dir(), "LanguageServer", "contrib",
                             "languageserver.sh")
            ]

        self._config = ClientConfig(
            name=self.name,
            binary_args=command,
            tcp_port=None,
            scopes=["source.julia"],
            syntaxes=["Packages/Julia/Julia.sublime-syntax"],
            languageId='julia',
            enabled=False,
            init_options=dict(),
            settings={"runlinter": True},
            env=dict())
コード例 #2
0
    def __init__(self):
        missing_java_home = "Unable to find a Java 8 or Java 11 installation on this computer. Please set `java_home` in the settings."
        plugin_settings = sublime.load_settings(settings_file)
        server_version = plugin_settings.get('server_version')
        server_properties = prepare_server_properties(
            plugin_settings.get('server_properties', []))
        java_path = get_java_path(plugin_settings.get('java_home'))

        launch_command = []
        if java_path and server_version:
            launch_command = create_launch_command(java_path, server_version,
                                                   server_properties)
        if java_path is None:
            sublime.error_message(missing_java_home)

        metals_config = ClientConfig(
            name=server_name,
            binary_args=launch_command,
            tcp_port=None,
            languages=[
                LanguageConfig("scala", ["source.scala"],
                               ["Packages/Scala/Scala.sublime-syntax"])
            ],
            enabled=True,
            init_options=dict(),
            settings=dict(),
            env=dict())
        self._name = server_name
        self._config = metals_config
コード例 #3
0
def get_cwtools_config():
    s = sublime.load_settings("LSP-cwtools.sublime-settings").get(
        'settings', default_cwtools_settings)
    return ClientConfig(
        name=config_name,
        binary_args=[dirname(__file__) + '/win-x64/CWTools Server.exe'],
        tcp_port=None,
        scopes=['source.stellaris'],
        syntaxes=[
            'Packages/StellarisSublime/Stellaris.sublime-syntax',
        ],
        languageId='stellaris',
        enabled=True,
        init_options=dict(),
        settings=s,
        env=dict())
コード例 #4
0
 def __init__(self):
     self._config = ClientConfig(
         name=self.name,
         binary_args=[
             ride_settings.r_binary(), "--quiet", "--slave", "-e",
             "languageserver::run()"
         ],
         tcp_port=None,
         scopes=["source.r", "text.html.markdown.rmarkdown"],
         syntaxes=[
             "Packages/R/R.sublime-syntax",
             "Packages/R-IDE/R Markdown.sublime-syntax"
         ],
         languageId='r',
         languages=[],
         enabled=False,
         init_options=dict(),
         settings={
             "diagnostics": ride_settings.get("diagnostics", True)
         },
         env={"PATH": ride_settings.custom_env("PATH")})
コード例 #5
0
        def __init__(self):
            clang_extraArgs = [
                "-I{}".format(R(script="cat(R.home('include'))"))
            ]
            if sys.platform == "darwin":
                try:
                    sysrootpath = subprocess.check_output(
                        ["xcrun", "--show-sdk-path"]).decode().strip()
                except Exception:
                    sysrootpath = "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk"
                if os.path.isdir(sysrootpath):
                    clang_extraArgs.append("-isysroot{}".format(sysrootpath))
                clang_extraArgs.append("-I/usr/include")
                clang_extraArgs.append("-I/usr/local/include")

            self._config = ClientConfig(
                name=self.name,
                binary_args=[ride_settings.get("ccls", "ccls")],
                tcp_port=None,
                scopes=["source.c", "source.c++", "source.c++.rcpp"],
                syntaxes=[
                    "Packages/C++/C.sublime-syntax",
                    "Packages/C++/C++.sublime-syntax",
                    "Packages/R-IDE/Rcpp.sublime-syntax"
                ],
                languageId='c++',
                languages=[],
                enabled=False,
                init_options={
                    "cache": {
                        "directory": tempfile.mkdtemp()
                    },
                    "clang": {
                        "extraArgs": clang_extraArgs
                    },
                    "client": {
                        "snippetSupport": False
                    }
                },
                settings=dict())
コード例 #6
0
 def __init__(self):
     path = ride_settings.get("r_binary_lsp", None)
     if not path:
         path = ride_settings.r_binary()
     self._config = ClientConfig(
         name=self.name,
         binary_args=[path, "--slave", "-e", "languageserver::run()"],
         tcp_port=None,
         scopes=["source.r", "text.html.markdown.rmarkdown"],
         syntaxes=[
             "Packages/R/R.sublime-syntax",
             "Packages/R-IDE/R Markdown.sublime-syntax"
         ],
         languageId='r',
         languages=[],
         enabled=False,
         init_options=dict(),
         settings={
             "diagnostics": ride_settings.get("diagnostics", True),
             "debug": ride_settings.get("lsp_debug", False)
         },
         env=ride_settings.ride_env())
コード例 #7
0
 def __init__(self):
     self._config = ClientConfig(
         name=self.name,
         binary_args=["cquery"],
         tcp_port=None,
         scopes=["source.c", "source.c++", "source.c++.rcpp"],
         syntaxes=[
             "Packages/C++/C.sublime-syntax",
             "Packages/C++/C++.sublime-syntax",
             "Packages/R-IDE/Rcpp.sublime-syntax"
         ],
         languageId='c++',
         languages=[],
         enabled=False,
         init_options={
             "cacheDirectory":
             tempfile.mkdtemp(),
             "extraClangArguments":
             ["-I{}".format(R(script="cat(R.home('include'))"))],
             "completion": {
                 "enableSnippets": False
             }
         },
         settings=dict())
コード例 #8
0
ファイル: test_completion.py プロジェクト: godla/LSP
class FakeClient(object):

    def __init__(self):
        self.response = None
        pass

    def get_capability(self, capability_name: str):
        return {
            'triggerCharacters': ['.'],
            'resolveProvider': False
        }


SUPPORTED_SCOPE = "text.plain"
SUPPORTED_SYNTAX = "Lang.sublime-syntax"
test_client_config = ClientConfig('langls', [], None, [SUPPORTED_SCOPE], [SUPPORTED_SYNTAX], 'lang')
test_file_path = dirname(__file__) + "/testfile.txt"


@unittest.skip('asd')
class InitializationTests(DeferrableTestCase):

    def setUp(self):
        self.view = sublime.active_window().new_file()
        self.old_configs = client_configs.all
        client_configs.all = [test_client_config]

    def test_is_not_applicable(self):
        self.assertFalse(CompletionHandler.is_applicable(dict()))

    def test_is_applicable(self):
コード例 #9
0
npm_command = 'npm'
server_command = 'lsp-tsserver'
if os.name == 'nt':
    npm_command = 'npm.cmd'
    server_command = 'lsp-tsserver.cmd'

default_config = ClientConfig(
    name=default_name,
    binary_args=[
        server_command, "--traceToConsole", "true", "--logVerbosity", "terse"
    ],
    tcp_port=None,
    enabled=False,
    init_options=dict(),
    settings=dict(),
    env=dict(),
    languages=[
        LanguageConfig("javascript", ["source.js", "source.jsx"], [
            "JavaScript (Babel).sublime-syntax",
            "Packages/JavaScript/JavaScript.sublime-syntax"
        ]),
        LanguageConfig(
            "typescript", ["source.ts", "source.tsx"],
            ["Packages/TypeScript-TmLanguage/TypeScript.tmLanguage"])
    ])


def node_is_installed() -> bool:
    return shutil.which("node") is not None

コード例 #10
0
from . import utils
from .utils import *

__version__ = "1.0.4"

default_name = 'dm-langserver'

default_config = ClientConfig(
    name=default_name,
    binary_args=[None],
    tcp_port=None,
    enabled=True,
    init_options=dict(),
    settings=dict(),
    env=dict(),
    languages=[
        LanguageConfig(
            'dreammaker', ['source.dm'],
            ["Packages/DreamMaker Language Client/dreammaker.tmLanguage"]),
    ],
    experimental_capabilities={'dreammaker': {
        'objectTree': True,
    }},
)

update_available = False
status_text = 'DM: Starting...'


def plugin_loaded():
    sublime.active_window().status_message(status_text)