neovim / nvim-lspconfig

Quickstart configs for Nvim LSP
Apache License 2.0
10.29k stars 2.04k forks source link

The server starts and attaches but nothing is working #1201

Closed kvietcong closed 3 years ago

kvietcong commented 3 years ago

Thanks for any help

How to reproduce the problem from neovim startup

There are no errors that pop up or anything. I just try to open up a JS file with a root detected

image

Actual behaviour

When I try to rename stuff or have errors, nothing pops up. It's as if the language server doesn't exist.

Expected behaviour

I was hoping diagnostics would pop up with renaming capabilities among other things

Minimal init.vim or init.lua and code sample

I used the minimal init lua and just replaced the server with tsserver but that didn't help either.

Here is a snippet from my (personal config)[https://github.com/kvietcong/le-custom/blob/master/dotfiles/.config/nvim/lua/lsp.lua]

local on_attach = function(client, buff)
        map("n gd           :lua vim.lsp.buf.definition()<Enter>", nil, buff)
        map("n gD           :lua vim.lsp.buf.declaration()<Enter>", nil, buff)
        map("n gi           :lua vim.lsp.buf.implementation()<Enter>", nil, buff)
        map("n <Leader>cs   :lua vim.lsp.buf.signature_help()<Enter>", nil, buff)
        map("n <Leader>ch   :lua vim.lsp.buf.hover()<Enter>", nil, buff)
        map("n gr           :lua vim.lsp.buf.rename()<Enter>", nil, buff)
        map("n <Leader>ca   :lua vim.lsp.buf.code_action()<Enter>", nil, buff)
        map("n <Leader>cf   :lua vim.lsp.buf.formatting()<Enter>", nil, buff)
    end

    -- TODO: For some reason, the extracted VSCode servers (HTML, CSS) don't work on Windows :(
    local servers = { "pyright", "hls", "clangd", "tsserver", "html", "cssls" }
    for _, server in pairs(servers) do
        require("lspconfig")[server].setup {
            on_attach = on_attach
        }
    end

    -- Lua Specific Server Configuration
    local sumneko_root
    local sumneko_binary
    -- Only have Lua configured for Windows atm
    if vim.fn.has("win32") == 1 then
        sumneko_root = "D:/Custom Binaries/lua-language-server-2.3/"
        sumneko_binary = sumneko_root .. "/bin/lua-language-server"
    end
    local runtime_path = vim.split(package.path, ';')
    table.insert(runtime_path, "lua/?.lua")
    table.insert(runtime_path, "lua/?/init.lua")
    require("lspconfig").sumneko_lua.setup {
        cmd = { sumneko_binary, "-E", sumneko_root .. "main.lua" };
        settings = { Lua = {
            runtime = { version = "LuaJIT", path = runtime_path },
            diagnostics = { globals = { "vim" } },
            workspace = { library = vim.api.nvim_get_runtime_file("", true) },
            telemetry = { enable = false }
        }},
        on_attach = on_attach
    }

Health check

Checkhealth result ![image](https://user-images.githubusercontent.com/32186663/131239667-0d80f22a-61d5-40bf-b571-b7f69cd1c7b5.png) ``` health#lspconfig#check ======================================================================== ## Checking language server protocol configuration - INFO: sumneko_lua: configuration checked. - INFO: hls: configuration checked. - INFO: html: configuration checked. - INFO: tsserver: configuration checked. - INFO: pyright: configuration checked. - INFO: clangd: configuration checked. - INFO: cssls: configuration checked. ```

LSP log

Log file ``` [ START ] 2021-08-27T19:11:17-0700 ] LSP logging initiated [ START ] 2021-08-27T19:23:19-0700 ] LSP logging initiated [ START ] 2021-08-27T19:25:10-0700 ] LSP logging initiated [ START ] 2021-08-27T19:23:51-0700 ] LSP logging initiated [ START ] 2021-08-28T00:49:13-0700 ] LSP logging initiated [ START ] 2021-08-28T00:51:49-0700 ] LSP logging initiated [ ERROR ] 2021-08-28T00:53:48-0700 ] ...gram Files\Neovim\share\nvim\runtime\lua\vim\lsp\rpc.lua:462 ] "rpc" "typescript-language-server.cmd" "stderr" "^C" [ START ] 2021-08-28T11:02:23-0700 ] LSP logging initiated [ ERROR ] 2021-08-28T12:07:15-0700 ] ...gram Files\Neovim\share\nvim\runtime\lua\vim\lsp\rpc.lua:573 ] "No callback found for server response id 1691" [ ERROR ] 2021-08-28T12:07:15-0700 ] D:\Program Files\Neovim\share\nvim\runtime\lua\vim\lsp.lua:708 ] "LSP[tsserver]" "on_error" { code = "NO_RESULT_CALLBACK_FOUND", err = { id = 1691, jsonrpc = "2.0" }} [ START ] 2021-08-28T12:07:25-0700 ] LSP logging initiated [ START ] 2021-08-28T12:08:20-0700 ] LSP logging initiated [ START ] 2021-08-28T12:09:33-0700 ] LSP logging initiated [ START ] 2021-08-28T12:11:13-0700 ] LSP logging initiated [ START ] 2021-08-28T12:14:24-0700 ] LSP logging initiated [ START ] 2021-08-28T12:19:22-0700 ] LSP logging initiated [ ERROR ] 2021-08-28T12:20:01-0700 ] ...gram Files\Neovim\share\nvim\runtime\lua\vim\lsp\rpc.lua:462 ] "rpc" "typescript-language-server.cmd" "stderr" "^C" [ START ] 2021-08-28T12:21:51-0700 ] LSP logging initiated [ START ] 2021-08-28T12:22:03-0700 ] LSP logging initiated [ START ] 2021-08-28T12:22:15-0700 ] LSP logging initiated [ START ] 2021-08-28T12:23:41-0700 ] LSP logging initiated [ START ] 2021-08-28T12:23:56-0700 ] LSP logging initiated [ START ] 2021-08-28T12:24:01-0700 ] LSP logging initiated [ START ] 2021-08-28T12:26:09-0700 ] LSP logging initiated [ START ] 2021-08-28T12:26:42-0700 ] LSP logging initiated [ START ] 2021-08-28T12:30:31-0700 ] LSP logging initiated [ START ] 2021-08-28T12:25:25-0700 ] LSP logging initiated [ START ] 2021-08-28T12:32:10-0700 ] LSP logging initiated [ START ] 2021-08-28T12:32:44-0700 ] LSP logging initiated [ START ] 2021-08-28T12:34:39-0700 ] LSP logging initiated [ START ] 2021-08-28T12:31:07-0700 ] LSP logging initiated [ START ] 2021-08-28T12:24:41-0700 ] LSP logging initiated [ START ] 2021-08-28T14:47:30-0700 ] LSP logging initiated [ START ] 2021-08-28T13:53:55-0700 ] LSP logging initiated [ START ] 2021-08-28T20:10:45-0700 ] LSP logging initiated [ START ] 2021-08-28T20:14:16-0700 ] LSP logging initiated [ ERROR ] 2021-08-28T20:14:32-0700 ] ...gram Files\Neovim\share\nvim\runtime\lua\vim\lsp\rpc.lua:462 ] "rpc" "D:/Custom Binaries/lua-language-server-2.3//bin/lua-language-server" "stderr" "script\\utility.lua:563: attempt to get length of a nil value (upvalue 'text')\r\nstack traceback:\r\n\tscript\\text-merger.lua:6: in upvalue 'splitRows'\r\n\tscript\\text-merger.lua:97: in function 'text-merger'\r\n\tscript\\provider\\provider.lua:235: in function \r\n\t[C]: in function 'xpcall'\r\n\tscript\\proto\\proto.lua:143: in function \r\n" [ ERROR ] 2021-08-28T20:14:32-0700 ] ...gram Files\Neovim\share\nvim\runtime\lua\vim\lsp\rpc.lua:462 ] "rpc" "D:/Custom Binaries/lua-language-server-2.3//bin/lua-language-server" "stderr" "script\\utility.lua:563: attempt to get length of a nil value (upvalue 'text')\r\nstack traceback:\r\n\tscript\\text-merger.lua:6: in upvalue 'splitRows'\r\n\tscript\\text-merger.lua:97: in function 'text-merger'\r\n\tscript\\provider\\provider.lua:235: in function \r\n\t[C]: in function 'xpcall'\r\n\tscript\\proto\\proto.lua:143: in function \r\n" [ ERROR ] 2021-08-28T20:14:32-0700 ] ...gram Files\Neovim\share\nvim\runtime\lua\vim\lsp\rpc.lua:462 ] "rpc" "D:/Custom Binaries/lua-language-server-2.3//bin/lua-language-server" "stderr" "script\\utility.lua:563: attempt to get length of a nil value (upvalue 'text')\r\nstack traceback:\r\n\tscript\\text-merger.lua:6: in upvalue 'splitRows'\r\n\tscript\\text-merger.lua:97: in function 'text-merger'\r\n\tscript\\provider\\provider.lua:235: in function \r\n\t[C]: in function 'xpcall'\r\n\tscript\\proto\\proto.lua:143: in function \r\n" [ START ] 2021-08-28T20:07:53-0700 ] LSP logging initiated [ START ] 2021-08-28T20:19:06-0700 ] LSP logging initiated [ ERROR ] 2021-08-28T20:19:53-0700 ] ...gram Files\Neovim\share\nvim\runtime\lua\vim\lsp\rpc.lua:462 ] "rpc" "D:/Custom Binaries/lua-language-server-2.3//bin/lua-language-server" "stderr" "script\\utility.lua:563: attempt to get length of a nil value (upvalue 'text')\r\nstack traceback:\r\n\tscript\\text-merger.lua:6: in upvalue 'splitRows'\r\n\tscript\\text-merger.lua:97: in function 'text-merger'\r\n\tscript\\provider\\provider.lua:235: in function \r\n\t[C]: in function 'xpcall'\r\n\tscript\\proto\\proto.lua:143: in function \r\n" [ ERROR ] 2021-08-28T20:19:53-0700 ] ...gram Files\Neovim\share\nvim\runtime\lua\vim\lsp\rpc.lua:462 ] "rpc" "D:/Custom Binaries/lua-language-server-2.3//bin/lua-language-server" "stderr" "script\\utility.lua:563: attempt to get length of a nil value (upvalue 'text')\r\nstack traceback:\r\n\tscript\\text-merger.lua:6: in upvalue 'splitRows'\r\n\tscript\\text-merger.lua:97: in function 'text-merger'\r\n\tscript\\provider\\provider.lua:235: in function \r\n\t[C]: in function 'xpcall'\r\n\tscript\\proto\\proto.lua:143: in function \r\n" [ ERROR ] 2021-08-28T20:19:53-0700 ] ...gram Files\Neovim\share\nvim\runtime\lua\vim\lsp\rpc.lua:462 ] "rpc" "D:/Custom Binaries/lua-language-server-2.3//bin/lua-language-server" "stderr" "script\\utility.lua:563: attempt to get length of a nil value (upvalue 'text')\r\nstack traceback:\r\n\tscript\\text-merger.lua:6: in upvalue 'splitRows'\r\n\tscript\\text-merger.lua:97: in function 'text-merger'\r\n\tscript\\provider\\provider.lua:235: in function \r\n\t[C]: in function 'xpcall'\r\n\tscript\\proto\\proto.lua:143: in function \r\n" [ ERROR ] 2021-08-28T20:19:53-0700 ] ...gram Files\Neovim\share\nvim\runtime\lua\vim\lsp\rpc.lua:462 ] "rpc" "D:/Custom Binaries/lua-language-server-2.3//bin/lua-language-server" "stderr" "script\\utility.lua:563: attempt to get length of a nil value (upvalue 'text')\r\nstack traceback:\r\n\tscript\\text-merger.lua:6: in upvalue 'splitRows'\r\n\tscript\\text-merger.lua:97: in function 'text-merger'\r\n\tscript\\provider\\provider.lua:235: in function \r\n\t[C]: in function 'xpcall'\r\n\tscript\\proto\\proto.lua:143: in function \r\n" [ START ] 2021-08-28T20:19:13-0700 ] LSP logging initiated [ START ] 2021-08-28T20:20:07-0700 ] LSP logging initiated [ START ] 2021-08-28T20:20:33-0700 ] LSP logging initiated [ START ] 2021-08-28T20:22:36-0700 ] LSP logging initiated [ WARN ] 2021-08-28T20:22:38-0700 ] ...Files\Neovim\share\nvim\runtime\lua\vim\lsp\handlers.lua:105 ] "The language server pyright triggers a registerCapability handler despite dynamicRegistration set to false. Report upstream, this warning is harmless" [ WARN ] 2021-08-28T20:22:39-0700 ] ...Files\Neovim\share\nvim\runtime\lua\vim\lsp\handlers.lua:425 ] "stubPath D:\\Documents\\Projects\\MechKB\\typings is not a valid directory." [ START ] 2021-08-28T20:23:03-0700 ] LSP logging initiated [ START ] 2021-08-28T20:27:31-0700 ] LSP logging initiated [ START ] 2021-08-28T20:30:43-0700 ] LSP logging initiated [ START ] 2021-08-28T20:32:40-0700 ] LSP logging initiated [ START ] 2021-08-28T20:39:30-0700 ] LSP logging initiated [ START ] 2021-08-28T20:40:40-0700 ] LSP logging initiated [ START ] 2021-08-28T20:20:03-0700 ] LSP logging initiated [ START ] 2021-08-28T20:44:45-0700 ] LSP logging initiated [ START ] 2021-08-28T22:17:12-0700 ] LSP logging initiated [ START ] 2021-08-28T22:18:40-0700 ] LSP logging initiated [ START ] 2021-08-28T22:18:55-0700 ] LSP logging initiated [ START ] 2021-08-28T22:19:11-0700 ] LSP logging initiated [ INFO ] 2021-08-28T22:19:17-0700 ] D:\Program Files\Neovim\share\nvim\runtime\lua\vim\lsp.lua:1216 ] "exit_handler" {} [ START ] 2021-08-28T22:19:20-0700 ] LSP logging initiated [ INFO ] 2021-08-28T22:19:29-0700 ] D:\Program Files\Neovim\share\nvim\runtime\lua\vim\lsp.lua:1216 ] "exit_handler" {} [ START ] 2021-08-28T22:19:32-0700 ] LSP logging initiated [ INFO ] 2021-08-28T22:20:10-0700 ] D:\Program Files\Neovim\share\nvim\runtime\lua\vim\lsp.lua:1216 ] "exit_handler" {} [ START ] 2021-08-28T22:20:14-0700 ] LSP logging initiated [ INFO ] 2021-08-28T22:20:15-0700 ] ...gram Files\Neovim\share\nvim\runtime\lua\vim\lsp\rpc.lua:316 ] "Starting RPC client" { args = { "--stdio" }, cmd = "typescript-language-server", extra = {}} [ INFO ] 2021-08-28T22:21:27-0700 ] D:\Program Files\Neovim\share\nvim\runtime\lua\vim\lsp.lua:1216 ] "exit_handler" {} [ START ] 2021-08-28T22:21:27-0700 ] LSP logging initiated [ INFO ] 2021-08-28T22:21:27-0700 ] ...gram Files\Neovim\share\nvim\runtime\lua\vim\lsp\rpc.lua:316 ] "Starting RPC client" { args = { "--stdio" }, cmd = "typescript-language-server.cmd", extra = {}} [ DEBUG ] 2021-08-28T22:21:28-0700 ] D:\Program Files\Neovim\share\nvim\runtime\lua\vim\lsp.lua:829 ] "LSP[tsserver]" "initialize_params" { capabilities = { callHierarchy = { dynamicRegistration = false }, textDocument = { codeAction = { codeActionLiteralSupport = { codeActionKind = { valueSet = { "", "Empty", "QuickFix", "Refactor", "RefactorExtract", "RefactorInline", "RefactorRewrite", "Source", "SourceOrganizeImports", "quickfix", "refactor", "refactor.extract", "refactor.inline", "refactor.rewrite", "source", "source.organizeImports" } } }, dynamicRegistration = false }, completion = { completionItem = { commitCharactersSupport = false, deprecatedSupport = false, documentationFormat = { "markdown", "plaintext" }, preselectSupport = false, snippetSupport = false }, completionItemKind = { valueSet = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25 } }, contextSupport = false, dynamicRegistration = false }, declaration = { linkSupport = true }, definition = { linkSupport = true }, documentHighlight = { dynamicRegistration = false }, documentSymbol = { dynamicRegistration = false, hierarchicalDocumentSymbolSupport = true, symbolKind = { valueSet = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26 } } }, hover = { contentFormat = { "markdown", "plaintext" }, dynamicRegistration = false }, implementation = { linkSupport = true }, publishDiagnostics = { relatedInformation = true, tagSupport = { valueSet = { 1, 2 } } }, references = { dynamicRegistration = false }, rename = { dynamicRegistration = false, prepareSupport = true }, signatureHelp = { dynamicRegistration = false, signatureInformation = { activeParameterSupport = true, documentationFormat = { "markdown", "plaintext" }, parameterInformation = { labelOffsetSupport = true } } }, synchronization = { didSave = true, dynamicRegistration = false, willSave = false, willSaveWaitUntil = false }, typeDefinition = { linkSupport = true } }, window = { showDocument = { support = false }, showMessage = { messageActionItem = { additionalPropertiesSupport = false } }, workDoneProgress = true }, workspace = { applyEdit = true, configuration = true, symbol = { dynamicRegistration = false, hierarchicalWorkspaceSymbolSupport = true, symbolKind = { valueSet = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26 } } }, workspaceEdit = { resourceOperations = { "rename", "create", "delete" } }, workspaceFolders = true } }, clientInfo = { name = "Neovim", version = "0.6.0" }, initializationOptions = { hostInfo = "neovim" }, processId = 5340, rootPath = "D:\\Documents\\Projects\\genetic-modeling", rootUri = "file:///D:/Documents/Projects/genetic-modeling", trace = "off", workspaceFolders = { { name = "D:\\Documents\\Projects\\genetic-modeling", uri = "file:///D:/Documents/Projects/genetic-modeling" } }} [ DEBUG ] 2021-08-28T22:21:28-0700 ] ...gram Files\Neovim\share\nvim\runtime\lua\vim\lsp\rpc.lua:395 ] "rpc.send.payload" { id = 1, jsonrpc = "2.0", method = "initialize", params = { capabilities = { callHierarchy = { dynamicRegistration = false }, textDocument = { codeAction = { codeActionLiteralSupport = { codeActionKind = { valueSet = { "", "Empty", "QuickFix", "Refactor", "RefactorExtract", "RefactorInline", "RefactorRewrite", "Source", "SourceOrganizeImports", "quickfix", "refactor", "refactor.extract", "refactor.inline", "refactor.rewrite", "source", "source.organizeImports" } } }, dynamicRegistration = false }, completion = { completionItem = { commitCharactersSupport = false, deprecatedSupport = false, documentationFormat = { "markdown", "plaintext" }, preselectSupport = false, snippetSupport = false }, completionItemKind = { valueSet = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25 } }, contextSupport = false, dynamicRegistration = false }, declaration = { linkSupport = true }, definition = { linkSupport = true }, documentHighlight = { dynamicRegistration = false }, documentSymbol = { dynamicRegistration = false, hierarchicalDocumentSymbolSupport = true, symbolKind = { valueSet = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26 } } }, hover = { contentFormat = { "markdown", "plaintext" }, dynamicRegistration = false }, implementation = { linkSupport = true }, publishDiagnostics = { relatedInformation = true, tagSupport = { valueSet = { 1, 2 } } }, references = { dynamicRegistration = false }, rename = { dynamicRegistration = false, prepareSupport = true }, signatureHelp = { dynamicRegistration = false, signatureInformation = { activeParameterSupport = true, documentationFormat = { "markdown", "plaintext" }, parameterInformation = { labelOffsetSupport = true } } }, synchronization = { didSave = true, dynamicRegistration = false, willSave = false, willSaveWaitUntil = false }, typeDefinition = { linkSupport = true } }, window = { showDocument = { support = false }, showMessage = { messageActionItem = { additionalPropertiesSupport = false } }, workDoneProgress = true }, workspace = { applyEdit = true, configuration = true, symbol = { dynamicRegistration = false, hierarchicalWorkspaceSymbolSupport = true, symbolKind = { valueSet = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26 } } }, workspaceEdit = { resourceOperations = { "rename", "create", "delete" } }, workspaceFolders = true } }, clientInfo = { name = "Neovim", version = "0.6.0" }, initializationOptions = { hostInfo = "neovim" }, processId = 5340, rootPath = "D:\\Documents\\Projects\\genetic-modeling", rootUri = "file:///D:/Documents/Projects/genetic-modeling", trace = "off", workspaceFolders = { { name = "D:\\Documents\\Projects\\genetic-modeling", uri = "file:///D:/Documents/Projects/genetic-modeling" } } }} [ DEBUG ] 2021-08-28T22:21:28-0700 ] ...gram Files\Neovim\share\nvim\runtime\lua\vim\lsp\rpc.lua:496 ] "decoded" { id = 1, jsonrpc = "2.0", result = { capabilities = { callsProvider = true, codeActionProvider = true, completionProvider = { resolveProvider = true, triggerCharacters = { ".", '"', "'", "/", "@", "<" } }, definitionProvider = true, documentFormattingProvider = true, documentHighlightProvider = true, documentRangeFormattingProvider = true, documentSymbolProvider = true, executeCommandProvider = { commands = { "_typescript.applyWorkspaceEdit", "_typescript.applyCodeAction", "_typescript.applyRefactoring", "_typescript.organizeImports", "_typescript.applyRenameFile" } }, foldingRangeProvider = true, hoverProvider = true, implementationProvider = true, referencesProvider = true, renameProvider = true, signatureHelpProvider = { triggerCharacters = { "(", ",", "<" } }, textDocumentSync = 2, typeDefinitionProvider = true, workspaceSymbolProvider = true } }} [ DEBUG ] 2021-08-28T22:21:28-0700 ] ...gram Files\Neovim\share\nvim\runtime\lua\vim\lsp\rpc.lua:395 ] "rpc.send.payload" { jsonrpc = "2.0", method = "initialized", params = { [true] = 6 }} [ DEBUG ] 2021-08-28T22:21:28-0700 ] D:\Program Files\Neovim\share\nvim\runtime\lua\vim\lsp.lua:856 ] "LSP[tsserver]" "server_capabilities" { callsProvider = true, codeActionProvider = true, completionProvider = { resolveProvider = true, triggerCharacters = { ".", '"', "'", "/", "@", "<" } }, definitionProvider = true, documentFormattingProvider = true, documentHighlightProvider = true, documentRangeFormattingProvider = true, documentSymbolProvider = true, executeCommandProvider = { commands = { "_typescript.applyWorkspaceEdit", "_typescript.applyCodeAction", "_typescript.applyRefactoring", "_typescript.organizeImports", "_typescript.applyRenameFile" } }, foldingRangeProvider = true, hoverProvider = true, implementationProvider = true, referencesProvider = true, renameProvider = true, signatureHelpProvider = { triggerCharacters = { "(", ",", "<" } }, textDocumentSync = 2, typeDefinitionProvider = true, workspaceSymbolProvider = true} [ INFO ] 2021-08-28T22:21:28-0700 ] D:\Program Files\Neovim\share\nvim\runtime\lua\vim\lsp.lua:857 ] "LSP[tsserver]" "initialized" { resolved_capabilities = { call_hierarchy = false, code_action = true, code_lens = false, code_lens_resolve = false, completion = true, declaration = false, document_formatting = true, document_highlight = true, document_range_formatting = true, document_symbol = true, execute_command = true, find_references = true, goto_definition = true, hover = true, implementation = true, rename = true, signature_help = true, signature_help_trigger_characters = { "(", ",", "<" }, text_document_did_change = 2, text_document_open_close = true, text_document_save = true, text_document_save_include_text = false, text_document_will_save = false, text_document_will_save_wait_until = false, type_definition = true, workspace_folder_properties = { changeNotifications = false, supported = false }, workspace_symbol = true }} [ DEBUG ] 2021-08-28T22:21:28-0700 ] ...gram Files\Neovim\share\nvim\runtime\lua\vim\lsp\rpc.lua:395 ] "rpc.send.payload" { jsonrpc = "2.0", method = "textDocument/didOpen", params = { textDocument = { languageId = "javascript", text = 'function getRandomInteger(min, max) {\n return round(Math.random() * (max - min) + min);\n}\n\nconst pow = Math.pow;\nconst ceil = Math.ceil;\nconst round = Math.round;\n\n// WARNING: INDEXING IS REALLY WEIRD RN. I NEED TO NORMALIZE HOW I/X AND J/Y WORKS. - KV\nconst PARAMS = {\n CELL_SIZE: 3,\n GENE_AMOUNT: 1,\n PARTITION_SIZE: 2,\n MUTATION_CHANCE: 0.1,\n FILL_TO: 0\n}\nPARAMS.GENE_DIMENSIONS = PARAMS.PARTITION_SIZE * 5\n\nconst INIT_FUNCS = {\n BLANK: (i, j) => 0,\n FILL: (i, j) => 1,\n RANDOM: (i, j) => getRandomInteger(0, 1),\n FILL_TO_PARTITION: (p, i, j) =>\n i < PARAMS.PARTITION_SIZE * p && j < PARAMS.PARTITION_SIZE * p\n ? 1 : 0,\n RANDOM_TO_PARTITION: (p, i, j) =>\n i < PARAMS.PARTITION_SIZE * p && j < PARAMS.PARTITION_SIZE * p\n ? getRandomInteger(0,1) : 0,\n}\n\nclass Gene {\n constructor(options = null) {\n if (options) {\n this.initializeCells((i,j) => options.cells[i][j]);\n } else {\n // this.initializeCells(INIT_FUNCS.BLANK); // Everything blank\n // this.initializeCells(INIT_FUNCS.RANDOM); // Random Everywhere\n // this.initializeCells((i,j) =>\n // INIT_FUNCS.RANDOM_TO_PARTITION(1, i, j)); // Random certain Partition\n this.initializeCells((i,j) =>\n INIT_FUNCS.FILL_TO_PARTITION(PARAMS.FILL_TO, i, j)); // Fill certain Partition\n }\n this.mutate();\n }\n\n copy() {\n return new Gene({cells: this.cells});\n }\n\n initializeCells(f) {\n const dimensions = PARAMS.GENE_DIMENSIONS;\n this.cells = [];\n\n for (let i = 0; i < dimensions; i++) {\n this.cells[i] = [];\n for (let j = 0; j < dimensions; j++) {\n this.cells[i][j] = f(i,j);\n }\n }\n this.generatePartitions();\n this.generateLevels();\n }\n\n // Very rough idea of partitions (shapes) which are represented with Integer Representation\n generatePartitions() {\n const partitionAmount = PARAMS.GENE_DIMENSIONS / PARAMS.PARTITION_SIZE;\n this.partitions = [];\n\n for (let i = 0; i < partitionAmount; i++) {\n this.partitions[i] = [];\n for (let j = 0; j < partitionAmount; j++) {\n this.partitions[i][j] = this.getPartition(i, j);\n }\n }\n }\n\n getPartition(i, j) {\n let partition = 0;\n const startX = PARAMS.PARTITION_SIZE * i;\n const startY = PARAMS.PARTITION_SIZE * j;\n const partitionSize = PARAMS.PARTITION_SIZE;\n\n for (let x = startX; x < startX + partitionSize; x++) {\n for (let y = startY; y < startY + partitionSize; y++) {\n partition += this.cells[x][y] == 1 ? pow(2,\n pow(partitionSize, 2) - 1 - ((x-startX) * partitionSize + (y-startY)))\n : 0;\n }\n }\n return partition;\n }\n\n generateLevels() {\n const levelAmount = round(PARAMS.GENE_DIMENSIONS / PARAMS.PARTITION_SIZE);\n const filledAmount = pow(2, pow(PARAMS.PARTITION_SIZE, 2)) - 1;\n this.levels = []\n\n for (let level = 0; level < levelAmount; level++) {\n this.levels[level] = 1;\n const checkFill = (i, j) =>\n this.levels[level] = this.partitions[i][j] !== filledAmount\n ? 0 : this.levels[level];\n\n let i, j;\n j = level;\n for (i = 0; i <= level; i++) checkFill(i, j);\n\n i = level;\n for (j = 0; i <= level; i++) checkFill(i, j);\n }\n }\n\n recombine(otherGene) {\n const newCells = [];\n\n const OR = (a, b) => ceil((a + b) / 2);\n const XOR = (a, b) => (a + b) % 2;\n const AND = (a, b) => (a + b) == 2 ? 1 : 0;\n\n for (let i = 0; i < this.cells.length; i++) {\n newCells[i] = [];\n for (let j = 0; j < this.cells.length; j++) {\n newCells[i][j] = OR(this.cells[i][j], otherGene.cells[i][j])\n }\n }\n return new Gene({cells: newCells});\n }\n\n getLevel() {\n let level = -1;\n while (this.levels[++level] === 1);\n return level;\n }\n\n mutate() {\n const level = this.getLevel();\n const chance = PARAMS.MUTATION_CHANCE;\n const partitionSize = PARAMS.PARTITION_SIZE;\n const partitionStart = partitionSize * level;\n\n const mutateCell = (i, j) => this.cells[i][j] =\n Math.random() <= chance ? (this.cells[i][j] + 1) % 2 : this.cells[i][j]\n\n for (let i = 0; i < partitionStart + partitionSize; i++)\n for (let j = partitionStart; j < partitionStart + partitionSize; j++)\n mutateCell(i, j);\n\n for (let i = partitionStart; i < partitionStart + partitionSize; i++)\n for (let j = 0; j < partitionStart + partitionSize; j++)\n mutateCell(i, j);\n\n this.generatePartitions();\n this.generateLevels();\n }\n\n toString() {\n return this.cells.map(row => row.join(" ")).join("\\n");\n }\n}\n\nclass Organism {\n constructor(options = null) {\n if (options) {\n ({\n genes: this.genes\n } = options);\n } else {\n this.randomizeGenes();\n }\n }\n\n copy() {\n return new Organism({genes: this.genes});\n }\n\n randomizeGenes() {\n this.genes = [];\n for (let i = 0; i < PARAMS.GENE_AMOUNT; i++) {\n this.genes[i] = new Gene();\n }\n }\n\n attachGameEngine(gameEngine, x, y) {\n Object.assign(this, {gameEngine, x, y})\n }\n\n draw(ctx) {\n const size = PARAMS.CELL_SIZE;\n const partitionSize = PARAMS.PARTITION_SIZE;\n\n const gene = this.genes[0];\n const cells = gene.cells;\n const colors = ["red", "green", "blue"];\n\n // Fill the grid up specially with levels in mind\n const x = this.x + size;\n const y = this.y + size;\n for (let level = 0; level < cells.length / partitionSize; level++) {\n const partitionStart = partitionSize * level;\n const fill = (i, j) => {\n ctx.fillStyle = cells[i][j] == 1\n ? colors[level % colors.length]\n : "white";\n ctx.fillRect(size * j + x, size * i + y, size, size);\n }\n\n for (let i = 0; i < partitionStart + partitionSize; i++)\n for (let j = partitionStart; j < partitionStart + partitionSize; j++)\n fill(i,j);\n\n for (let i = partitionStart; i < partitionStart + partitionSize; i++)\n for (let j = 0; j < partitionStart + partitionSize; j++)\n fill(i,j);\n }\n\n // Outline for box for clarity\n ctx.lineWidth = size;\n ctx.strokeStyle = "black";\n ctx.strokeRect(this.x+size/2, this.y+size/2,\n size * cells.length + size, size * cells.length + size);\n }\n\n update() {\n }\n\n reproduce(otherOrganism) {\n const otherGenes = otherOrganism.genes;\n if (this.genes.length !== otherGenes.length) return console.log("Incompatible!");\n\n const newGenes = []\n\n for (let i = 0; i < this.genes.length; i++) {\n newGenes[i] = this.genes[i].recombine(otherGenes[i]);\n }\n\n return new Organism({genes: newGenes});\n }\n\n toString() {\n return this.genes.map(gene => gene.toString()).join("\\n");\n }\n}\n\nconst testOrganism1 = new Organism();\nconst testOrganism2 = new Organism();\nconsole.log(testOrganism1.toString(), "\\n");\n/* console.log(testOrganism2.toString(), "\\n");\nconsole.log(testOrganism1.reproduce(testOrganism2).toString()); */\nconsole.log(testOrganism1.genes[0].partitions);\nconsole.log(testOrganism1.genes[0].levels);\n', uri = "D:\\Documents\\Projects\\genetic-modeling\\organism.js", version = 0 } }} [ DEBUG ] 2021-08-28T22:21:28-0700 ] ...Files\Neovim\share\nvim\runtime\lua\vim\lsp\handlers.lua:455 ] "default_handler" "textDocument/publishDiagnostics" { bufnr = 1, client_id = 1, params = { diagnostics = {}, uri = "D:\\Documents\\Projects\\genetic-modeling\\organism.js" }} [ DEBUG ] 2021-08-28T22:21:49-0700 ] D:\Program Files\Neovim\share\nvim\runtime\lua\vim\lsp.lua:897 ] "LSP[tsserver]" "client.request" 1 "textDocument/rename" { newName = "power", position = { character = 7, line = 4 }, textDocument = { uri = "D:\\Documents\\Projects\\genetic-modeling\\organism.js" }} 1 [ DEBUG ] 2021-08-28T22:21:49-0700 ] ...gram Files\Neovim\share\nvim\runtime\lua\vim\lsp\rpc.lua:395 ] "rpc.send.payload" { id = 2, jsonrpc = "2.0", method = "textDocument/rename", params = { newName = "power", position = { character = 7, line = 4 }, textDocument = { uri = "D:\\Documents\\Projects\\genetic-modeling\\organism.js" } }} [ DEBUG ] 2021-08-28T22:21:49-0700 ] ...gram Files\Neovim\share\nvim\runtime\lua\vim\lsp\rpc.lua:496 ] "decoded" { id = 2, jsonrpc = "2.0", result = vim.NIL} [ DEBUG ] 2021-08-28T22:21:49-0700 ] ...Files\Neovim\share\nvim\runtime\lua\vim\lsp\handlers.lua:455 ] "default_handler" "textDocument/rename" { bufnr = 1, client_id = 1} [ INFO ] 2021-08-28T22:22:02-0700 ] D:\Program Files\Neovim\share\nvim\runtime\lua\vim\lsp.lua:1216 ] "exit_handler" { { _on_attach = , cancel_request = , config = { _on_attach = , autostart = true, capabilities = { callHierarchy = { dynamicRegistration = false }, textDocument = { codeAction = { codeActionLiteralSupport = { codeActionKind = { valueSet = { "", "Empty", "QuickFix", "Refactor", "RefactorExtract", "RefactorInline", "RefactorRewrite", "Source", "SourceOrganizeImports", "quickfix", "refactor", "refactor.extract", "refactor.inline", "refactor.rewrite", "source", "source.organizeImports" } } }, dynamicRegistration = false }, completion = { completionItem = { commitCharactersSupport = false, deprecatedSupport = false, documentationFormat = { "markdown", "plaintext" }, preselectSupport = false, snippetSupport = false }, completionItemKind = { valueSet = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25 } }, contextSupport = false, dynamicRegistration = false }, declaration = { linkSupport = true }, definition = { linkSupport = true }, documentHighlight = { dynamicRegistration = false }, documentSymbol = { dynamicRegistration = false, hierarchicalDocumentSymbolSupport = true, symbolKind = { valueSet = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26 } } }, hover = { contentFormat = { "markdown", "plaintext" }, dynamicRegistration = false }, implementation = { linkSupport = true }, publishDiagnostics = { relatedInformation = true, tagSupport = { valueSet = { 1, 2 } } }, references = { dynamicRegistration = false }, rename = { dynamicRegistration = false, prepareSupport = true }, signatureHelp = { dynamicRegistration = false, signatureInformation = { activeParameterSupport = true, documentationFormat = { "markdown", "plaintext" }, parameterInformation = { labelOffsetSupport = true } } }, synchronization = { didSave = true, dynamicRegistration = false, willSave = false, willSaveWaitUntil = false }, typeDefinition = { linkSupport = true } }, window = { showDocument = { support = false }, showMessage = { messageActionItem = { additionalPropertiesSupport = false } }, workDoneProgress = true }, workspace = { applyEdit = true, configuration = true, symbol = { dynamicRegistration = false, hierarchicalWorkspaceSymbolSupport = true, symbolKind = { valueSet = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26 } } }, workspaceEdit = { resourceOperations = { "rename", "create", "delete" } }, workspaceFolders = true } }, cmd = { "typescript-language-server.cmd", "--stdio" }, filetypes = { "javascript", "javascriptreact", "javascript.jsx", "typescript", "typescriptreact", "typescript.tsx" }, flags = {}, get_language_id = , handlers = <1>{}, init_options = { hostInfo = "neovim" }, log_level = 2, message_level = 2, name = "tsserver", on_attach = , on_exit = , on_init = , root_dir = "D:\\Documents\\Projects\\genetic-modeling", settings = vim.empty_dict(), workspace_folders = <2>{ { name = "D:\\Documents\\Projects\\genetic-modeling", uri = "file:///D:/Documents/Projects/genetic-modeling" } }, = <3>{ __tostring = } }, handlers = , id = 1, initialized = true, is_stopped = , messages = { messages = {}, name = "tsserver", progress = {}, status = {} }, name = "tsserver", notify = , offset_encoding = "utf-16", request = , request_sync = , resolved_capabilities = { call_hierarchy = false, code_action = true, code_lens = false, code_lens_resolve = false, completion = true, declaration = false, document_formatting = true, document_highlight = true, document_range_formatting = true, document_symbol = true, execute_command = true, find_references = true, goto_definition = true, hover = true, implementation = true, rename = true, signature_help = true, signature_help_trigger_characters = <4>{ "(", ",", "<" }, text_document_did_change = 2, text_document_open_close = true, text_document_save = true, text_document_save_include_text = false, text_document_will_save = false, text_document_will_save_wait_until = false, type_definition = true, workspace_folder_properties = { changeNotifications = false, supported = false }, workspace_symbol = true }, rpc = { handle = , notify = , pid = 5092, request = }, server_capabilities = { callsProvider = true, codeActionProvider = true, completionProvider = { resolveProvider = true, triggerCharacters = { ".", '"', "'", "/", "@", "<" } }, definitionProvider = true, documentFormattingProvider = true, documentHighlightProvider = true, documentRangeFormattingProvider = true, documentSymbolProvider = true, executeCommandProvider = { commands = { "_typescript.applyWorkspaceEdit", "_typescript.applyCodeAction", "_typescript.applyRefactoring", "_typescript.organizeImports", "_typescript.applyRenameFile" } }, foldingRangeProvider = true, hoverProvider = true, implementationProvider = true, referencesProvider = true, renameProvider = true, signatureHelpProvider = { triggerCharacters =
}, textDocumentSync = 2, typeDefinitionProvider = true, workspaceSymbolProvider = true }, stop = , supports_method = , workspaceFolders =
, workspace_did_change_configuration = } } [ DEBUG ] 2021-08-28T22:22:02-0700 ] ...gram Files\Neovim\share\nvim\runtime\lua\vim\lsp\rpc.lua:395 ] "rpc.send.payload" { id = 3, jsonrpc = "2.0", method = "shutdown"} [ DEBUG ] 2021-08-28T22:22:02-0700 ] ...gram Files\Neovim\share\nvim\runtime\lua\vim\lsp\rpc.lua:496 ] "decoded" { id = 3, jsonrpc = "2.0", result = vim.NIL} [ DEBUG ] 2021-08-28T22:22:02-0700 ] ...gram Files\Neovim\share\nvim\runtime\lua\vim\lsp\rpc.lua:395 ] "rpc.send.payload" { jsonrpc = "2.0", method = "exit"} [ START ] 2021-08-28T22:22:06-0700 ] LSP logging initiated [ INFO ] 2021-08-28T22:22:07-0700 ] ...gram Files\Neovim\share\nvim\runtime\lua\vim\lsp\rpc.lua:316 ] "Starting RPC client" { args = { "--stdio" }, cmd = "typescript-language-server.cmd", extra = {}} [ DEBUG ] 2021-08-28T22:22:07-0700 ] D:\Program Files\Neovim\share\nvim\runtime\lua\vim\lsp.lua:829 ] "LSP[tsserver]" "initialize_params" { capabilities = { callHierarchy = { dynamicRegistration = false }, textDocument = { codeAction = { codeActionLiteralSupport = { codeActionKind = { valueSet = { "", "Empty", "QuickFix", "Refactor", "RefactorExtract", "RefactorInline", "RefactorRewrite", "Source", "SourceOrganizeImports", "quickfix", "refactor", "refactor.extract", "refactor.inline", "refactor.rewrite", "source", "source.organizeImports" } } }, dynamicRegistration = false }, completion = { completionItem = { commitCharactersSupport = false, deprecatedSupport = false, documentationFormat = { "markdown", "plaintext" }, preselectSupport = false, snippetSupport = false }, completionItemKind = { valueSet = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25 } }, contextSupport = false, dynamicRegistration = false }, declaration = { linkSupport = true }, definition = { linkSupport = true }, documentHighlight = { dynamicRegistration = false }, documentSymbol = { dynamicRegistration = false, hierarchicalDocumentSymbolSupport = true, symbolKind = { valueSet = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26 } } }, hover = { contentFormat = { "markdown", "plaintext" }, dynamicRegistration = false }, implementation = { linkSupport = true }, publishDiagnostics = { relatedInformation = true, tagSupport = { valueSet = { 1, 2 } } }, references = { dynamicRegistration = false }, rename = { dynamicRegistration = false, prepareSupport = true }, signatureHelp = { dynamicRegistration = false, signatureInformation = { activeParameterSupport = true, documentationFormat = { "markdown", "plaintext" }, parameterInformation = { labelOffsetSupport = true } } }, synchronization = { didSave = true, dynamicRegistration = false, willSave = false, willSaveWaitUntil = false }, typeDefinition = { linkSupport = true } }, window = { showDocument = { support = false }, showMessage = { messageActionItem = { additionalPropertiesSupport = false } }, workDoneProgress = true }, workspace = { applyEdit = true, configuration = true, symbol = { dynamicRegistration = false, hierarchicalWorkspaceSymbolSupport = true, symbolKind = { valueSet = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26 } } }, workspaceEdit = { resourceOperations = { "rename", "create", "delete" } }, workspaceFolders = true } }, clientInfo = { name = "Neovim", version = "0.6.0" }, initializationOptions = { hostInfo = "neovim" }, processId = 9348, rootPath = "D:\\Documents\\Projects\\genetic-modeling", rootUri = "file:///D:/Documents/Projects/genetic-modeling", trace = "off", workspaceFolders = { { name = "D:\\Documents\\Projects\\genetic-modeling", uri = "file:///D:/Documents/Projects/genetic-modeling" } }} [ DEBUG ] 2021-08-28T22:22:07-0700 ] ...gram Files\Neovim\share\nvim\runtime\lua\vim\lsp\rpc.lua:395 ] "rpc.send.payload" { id = 1, jsonrpc = "2.0", method = "initialize", params = { capabilities = { callHierarchy = { dynamicRegistration = false }, textDocument = { codeAction = { codeActionLiteralSupport = { codeActionKind = { valueSet = { "", "Empty", "QuickFix", "Refactor", "RefactorExtract", "RefactorInline", "RefactorRewrite", "Source", "SourceOrganizeImports", "quickfix", "refactor", "refactor.extract", "refactor.inline", "refactor.rewrite", "source", "source.organizeImports" } } }, dynamicRegistration = false }, completion = { completionItem = { commitCharactersSupport = false, deprecatedSupport = false, documentationFormat = { "markdown", "plaintext" }, preselectSupport = false, snippetSupport = false }, completionItemKind = { valueSet = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25 } }, contextSupport = false, dynamicRegistration = false }, declaration = { linkSupport = true }, definition = { linkSupport = true }, documentHighlight = { dynamicRegistration = false }, documentSymbol = { dynamicRegistration = false, hierarchicalDocumentSymbolSupport = true, symbolKind = { valueSet = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26 } } }, hover = { contentFormat = { "markdown", "plaintext" }, dynamicRegistration = false }, implementation = { linkSupport = true }, publishDiagnostics = { relatedInformation = true, tagSupport = { valueSet = { 1, 2 } } }, references = { dynamicRegistration = false }, rename = { dynamicRegistration = false, prepareSupport = true }, signatureHelp = { dynamicRegistration = false, signatureInformation = { activeParameterSupport = true, documentationFormat = { "markdown", "plaintext" }, parameterInformation = { labelOffsetSupport = true } } }, synchronization = { didSave = true, dynamicRegistration = false, willSave = false, willSaveWaitUntil = false }, typeDefinition = { linkSupport = true } }, window = { showDocument = { support = false }, showMessage = { messageActionItem = { additionalPropertiesSupport = false } }, workDoneProgress = true }, workspace = { applyEdit = true, configuration = true, symbol = { dynamicRegistration = false, hierarchicalWorkspaceSymbolSupport = true, symbolKind = { valueSet = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26 } } }, workspaceEdit = { resourceOperations = { "rename", "create", "delete" } }, workspaceFolders = true } }, clientInfo = { name = "Neovim", version = "0.6.0" }, initializationOptions = { hostInfo = "neovim" }, processId = 9348, rootPath = "D:\\Documents\\Projects\\genetic-modeling", rootUri = "file:///D:/Documents/Projects/genetic-modeling", trace = "off", workspaceFolders = { { name = "D:\\Documents\\Projects\\genetic-modeling", uri = "file:///D:/Documents/Projects/genetic-modeling" } } }} [ DEBUG ] 2021-08-28T22:22:07-0700 ] ...gram Files\Neovim\share\nvim\runtime\lua\vim\lsp\rpc.lua:496 ] "decoded" { id = 1, jsonrpc = "2.0", result = { capabilities = { callsProvider = true, codeActionProvider = true, completionProvider = { resolveProvider = true, triggerCharacters = { ".", '"', "'", "/", "@", "<" } }, definitionProvider = true, documentFormattingProvider = true, documentHighlightProvider = true, documentRangeFormattingProvider = true, documentSymbolProvider = true, executeCommandProvider = { commands = { "_typescript.applyWorkspaceEdit", "_typescript.applyCodeAction", "_typescript.applyRefactoring", "_typescript.organizeImports", "_typescript.applyRenameFile" } }, foldingRangeProvider = true, hoverProvider = true, implementationProvider = true, referencesProvider = true, renameProvider = true, signatureHelpProvider = { triggerCharacters = { "(", ",", "<" } }, textDocumentSync = 2, typeDefinitionProvider = true, workspaceSymbolProvider = true } }} [ DEBUG ] 2021-08-28T22:22:07-0700 ] ...gram Files\Neovim\share\nvim\runtime\lua\vim\lsp\rpc.lua:395 ] "rpc.send.payload" { jsonrpc = "2.0", method = "initialized", params = { [true] = 6 }} [ DEBUG ] 2021-08-28T22:22:07-0700 ] D:\Program Files\Neovim\share\nvim\runtime\lua\vim\lsp.lua:856 ] "LSP[tsserver]" "server_capabilities" { callsProvider = true, codeActionProvider = true, completionProvider = { resolveProvider = true, triggerCharacters = { ".", '"', "'", "/", "@", "<" } }, definitionProvider = true, documentFormattingProvider = true, documentHighlightProvider = true, documentRangeFormattingProvider = true, documentSymbolProvider = true, executeCommandProvider = { commands = { "_typescript.applyWorkspaceEdit", "_typescript.applyCodeAction", "_typescript.applyRefactoring", "_typescript.organizeImports", "_typescript.applyRenameFile" } }, foldingRangeProvider = true, hoverProvider = true, implementationProvider = true, referencesProvider = true, renameProvider = true, signatureHelpProvider = { triggerCharacters = { "(", ",", "<" } }, textDocumentSync = 2, typeDefinitionProvider = true, workspaceSymbolProvider = true} [ INFO ] 2021-08-28T22:22:07-0700 ] D:\Program Files\Neovim\share\nvim\runtime\lua\vim\lsp.lua:857 ] "LSP[tsserver]" "initialized" { resolved_capabilities = { call_hierarchy = false, code_action = true, code_lens = false, code_lens_resolve = false, completion = true, declaration = false, document_formatting = true, document_highlight = true, document_range_formatting = true, document_symbol = true, execute_command = true, find_references = true, goto_definition = true, hover = true, implementation = true, rename = true, signature_help = true, signature_help_trigger_characters = { "(", ",", "<" }, text_document_did_change = 2, text_document_open_close = true, text_document_save = true, text_document_save_include_text = false, text_document_will_save = false, text_document_will_save_wait_until = false, type_definition = true, workspace_folder_properties = { changeNotifications = false, supported = false }, workspace_symbol = true }} [ DEBUG ] 2021-08-28T22:22:07-0700 ] ...gram Files\Neovim\share\nvim\runtime\lua\vim\lsp\rpc.lua:395 ] "rpc.send.payload" { jsonrpc = "2.0", method = "textDocument/didOpen", params = { textDocument = { languageId = "javascript", text = 'function getRandomInteger(min, max) {\n return round(Math.random() * (max - min) + min);\n}\n\nconst pow = Math.pow;\nconst ceil = Math.ceil;\nconst round = Math.round;\n\n// WARNING: INDEXING IS REALLY WEIRD RN. I NEED TO NORMALIZE HOW I/X AND J/Y WORKS. - KV\nconst PARAMS = {\n CELL_SIZE: 3,\n GENE_AMOUNT: 1,\n PARTITION_SIZE: 2,\n MUTATION_CHANCE: 0.1,\n FILL_TO: 0\n}\nPARAMS.GENE_DIMENSIONS = PARAMS.PARTITION_SIZE * 5\n\nconst INIT_FUNCS = {\n BLANK: (i, j) => 0,\n FILL: (i, j) => 1,\n RANDOM: (i, j) => getRandomInteger(0, 1),\n FILL_TO_PARTITION: (p, i, j) =>\n i < PARAMS.PARTITION_SIZE * p && j < PARAMS.PARTITION_SIZE * p\n ? 1 : 0,\n RANDOM_TO_PARTITION: (p, i, j) =>\n i < PARAMS.PARTITION_SIZE * p && j < PARAMS.PARTITION_SIZE * p\n ? getRandomInteger(0,1) : 0,\n}\n\nclass Gene {\n constructor(options = null) {\n if (options) {\n this.initializeCells((i,j) => options.cells[i][j]);\n } else {\n // this.initializeCells(INIT_FUNCS.BLANK); // Everything blank\n // this.initializeCells(INIT_FUNCS.RANDOM); // Random Everywhere\n // this.initializeCells((i,j) =>\n // INIT_FUNCS.RANDOM_TO_PARTITION(1, i, j)); // Random certain Partition\n this.initializeCells((i,j) =>\n INIT_FUNCS.FILL_TO_PARTITION(PARAMS.FILL_TO, i, j)); // Fill certain Partition\n }\n this.mutate();\n }\n\n copy() {\n return new Gene({cells: this.cells});\n }\n\n initializeCells(f) {\n const dimensions = PARAMS.GENE_DIMENSIONS;\n this.cells = [];\n\n for (let i = 0; i < dimensions; i++) {\n this.cells[i] = [];\n for (let j = 0; j < dimensions; j++) {\n this.cells[i][j] = f(i,j);\n }\n }\n this.generatePartitions();\n this.generateLevels();\n }\n\n // Very rough idea of partitions (shapes) which are represented with Integer Representation\n generatePartitions() {\n const partitionAmount = PARAMS.GENE_DIMENSIONS / PARAMS.PARTITION_SIZE;\n this.partitions = [];\n\n for (let i = 0; i < partitionAmount; i++) {\n this.partitions[i] = [];\n for (let j = 0; j < partitionAmount; j++) {\n this.partitions[i][j] = this.getPartition(i, j);\n }\n }\n }\n\n getPartition(i, j) {\n let partition = 0;\n const startX = PARAMS.PARTITION_SIZE * i;\n const startY = PARAMS.PARTITION_SIZE * j;\n const partitionSize = PARAMS.PARTITION_SIZE;\n\n for (let x = startX; x < startX + partitionSize; x++) {\n for (let y = startY; y < startY + partitionSize; y++) {\n partition += this.cells[x][y] == 1 ? pow(2,\n pow(partitionSize, 2) - 1 - ((x-startX) * partitionSize + (y-startY)))\n : 0;\n }\n }\n return partition;\n }\n\n generateLevels() {\n const levelAmount = round(PARAMS.GENE_DIMENSIONS / PARAMS.PARTITION_SIZE);\n const filledAmount = pow(2, pow(PARAMS.PARTITION_SIZE, 2)) - 1;\n this.levels = []\n\n for (let level = 0; level < levelAmount; level++) {\n this.levels[level] = 1;\n const checkFill = (i, j) =>\n this.levels[level] = this.partitions[i][j] !== filledAmount\n ? 0 : this.levels[level];\n\n let i, j;\n j = level;\n for (i = 0; i <= level; i++) checkFill(i, j);\n\n i = level;\n for (j = 0; i <= level; i++) checkFill(i, j);\n }\n }\n\n recombine(otherGene) {\n const newCells = [];\n\n const OR = (a, b) => ceil((a + b) / 2);\n const XOR = (a, b) => (a + b) % 2;\n const AND = (a, b) => (a + b) == 2 ? 1 : 0;\n\n for (let i = 0; i < this.cells.length; i++) {\n newCells[i] = [];\n for (let j = 0; j < this.cells.length; j++) {\n newCells[i][j] = OR(this.cells[i][j], otherGene.cells[i][j])\n }\n }\n return new Gene({cells: newCells});\n }\n\n getLevel() {\n let level = -1;\n while (this.levels[++level] === 1);\n return level;\n }\n\n mutate() {\n const level = this.getLevel();\n const chance = PARAMS.MUTATION_CHANCE;\n const partitionSize = PARAMS.PARTITION_SIZE;\n const partitionStart = partitionSize * level;\n\n const mutateCell = (i, j) => this.cells[i][j] =\n Math.random() <= chance ? (this.cells[i][j] + 1) % 2 : this.cells[i][j]\n\n for (let i = 0; i < partitionStart + partitionSize; i++)\n for (let j = partitionStart; j < partitionStart + partitionSize; j++)\n mutateCell(i, j);\n\n for (let i = partitionStart; i < partitionStart + partitionSize; i++)\n for (let j = 0; j < partitionStart + partitionSize; j++)\n mutateCell(i, j);\n\n this.generatePartitions();\n this.generateLevels();\n }\n\n toString() {\n return this.cells.map(row => row.join(" ")).join("\\n");\n }\n}\n\nclass Organism {\n constructor(options = null) {\n if (options) {\n ({\n genes: this.genes\n } = options);\n } else {\n this.randomizeGenes();\n }\n }\n\n copy() {\n return new Organism({genes: this.genes});\n }\n\n randomizeGenes() {\n this.genes = [];\n for (let i = 0; i < PARAMS.GENE_AMOUNT; i++) {\n this.genes[i] = new Gene();\n }\n }\n\n attachGameEngine(gameEngine, x, y) {\n Object.assign(this, {gameEngine, x, y})\n }\n\n draw(ctx) {\n const size = PARAMS.CELL_SIZE;\n const partitionSize = PARAMS.PARTITION_SIZE;\n\n const gene = this.genes[0];\n const cells = gene.cells;\n const colors = ["red", "green", "blue"];\n\n // Fill the grid up specially with levels in mind\n const x = this.x + size;\n const y = this.y + size;\n for (let level = 0; level < cells.length / partitionSize; level++) {\n const partitionStart = partitionSize * level;\n const fill = (i, j) => {\n ctx.fillStyle = cells[i][j] == 1\n ? colors[level % colors.length]\n : "white";\n ctx.fillRect(size * j + x, size * i + y, size, size);\n }\n\n for (let i = 0; i < partitionStart + partitionSize; i++)\n for (let j = partitionStart; j < partitionStart + partitionSize; j++)\n fill(i,j);\n\n for (let i = partitionStart; i < partitionStart + partitionSize; i++)\n for (let j = 0; j < partitionStart + partitionSize; j++)\n fill(i,j);\n }\n\n // Outline for box for clarity\n ctx.lineWidth = size;\n ctx.strokeStyle = "black";\n ctx.strokeRect(this.x+size/2, this.y+size/2,\n size * cells.length + size, size * cells.length + size);\n }\n\n update() {\n }\n\n reproduce(otherOrganism) {\n const otherGenes = otherOrganism.genes;\n if (this.genes.length !== otherGenes.length) return console.log("Incompatible!");\n\n const newGenes = []\n\n for (let i = 0; i < this.genes.length; i++) {\n newGenes[i] = this.genes[i].recombine(otherGenes[i]);\n }\n\n return new Organism({genes: newGenes});\n }\n\n toString() {\n return this.genes.map(gene => gene.toString()).join("\\n");\n }\n}\n\nconst testOrganism1 = new Organism();\nconst testOrganism2 = new Organism();\nconsole.log(testOrganism1.toString(), "\\n");\n/* console.log(testOrganism2.toString(), "\\n");\nconsole.log(testOrganism1.reproduce(testOrganism2).toString()); */\nconsole.log(testOrganism1.genes[0].partitions);\nconsole.log(testOrganism1.genes[0].levels);\n', uri = "D:\\Documents\\Projects\\genetic-modeling\\organism.js", version = 0 } }} [ DEBUG ] 2021-08-28T22:22:07-0700 ] ...Files\Neovim\share\nvim\runtime\lua\vim\lsp\handlers.lua:455 ] "default_handler" "textDocument/publishDiagnostics" { bufnr = 1, client_id = 1, params = { diagnostics = {}, uri = "D:\\Documents\\Projects\\genetic-modeling\\organism.js" }} [ DEBUG ] 2021-08-28T22:22:14-0700 ] D:\Program Files\Neovim\share\nvim\runtime\lua\vim\lsp.lua:897 ] "LSP[tsserver]" "client.request" 1 "textDocument/rename" { newName = "PARAMSS", position = { character = 7, line = 9 }, textDocument = { uri = "D:\\Documents\\Projects\\genetic-modeling\\organism.js" }} 1 [ DEBUG ] 2021-08-28T22:22:14-0700 ] ...gram Files\Neovim\share\nvim\runtime\lua\vim\lsp\rpc.lua:395 ] "rpc.send.payload" { id = 2, jsonrpc = "2.0", method = "textDocument/rename", params = { newName = "PARAMSS", position = { character = 7, line = 9 }, textDocument = { uri = "D:\\Documents\\Projects\\genetic-modeling\\organism.js" } }} [ DEBUG ] 2021-08-28T22:22:14-0700 ] ...gram Files\Neovim\share\nvim\runtime\lua\vim\lsp\rpc.lua:496 ] "decoded" { id = 2, jsonrpc = "2.0", result = vim.NIL} [ DEBUG ] 2021-08-28T22:22:14-0700 ] ...Files\Neovim\share\nvim\runtime\lua\vim\lsp\handlers.lua:455 ] "default_handler" "textDocument/rename" { bufnr = 1, client_id = 1} ```
justinmk commented 3 years ago

"stubPath D:\Documents\Projects\MechKB\typings is not a valid directory."

maybe this is this problem?

mjlbach commented 3 years ago

@justinmk That's for pyright, AFAIK the issue is for typescript. @kvietcong Did you install both typescript language server and typescript as suggested in CONFIG.md, and verify both are on your system path, and that you can start both individually from the command line without error? Also what node version are you on?

kvietcong commented 3 years ago

Yes, I have installed it using the suggestions in CONFIG.md. They are both in the system path and I can start them in the command line without error. I currently am on node v16.4.1. However, I also have yarn if that makes any difference. I have also installed tsserver through yarn globally but to no avail.

mjlbach commented 3 years ago

Not sure then, I don't have any issues running on windows :/

kvietcong commented 3 years ago

I see, thanks for your help, I appreciate it. I'm going to just blame Windows XD. I've been having trouble with Treesitter too. Guess I'll be moving back to Linux

kaykhancheckpoint commented 2 years ago

@kvietcong I'm having this same porblem now, did you get this working?

kvietcong commented 2 years ago

Sorry @kaykhancheckpoint, I haven't been able to resolve this. I'm just assuming it's some deep rooted Windows issue I'm not willing to debug 😔

webmandman commented 2 years ago

@kvietcong I can call typescirpt-language-server -V and get 0.6.2, and :LspInfo lists tsserver as attached to the current buffer.

How do you call the typescript command to make sure its available in PATH?

Since typescript-language-server depends on typescript and it outputs the version I assume both are working properly.

kvietcong commented 2 years ago

I use the default typescript/javascript config. It launches and attaches as seen in my issue but it still doesn't work. It also works from the command line

mjlbach commented 2 years ago

Try on the 0.5 release, there's a URI issue on windows on master rn

kvietcong commented 2 years ago

Oh thanks @mjlbach that did it. I should have tried downgrading in the first place lol. I appreciate the fix. I'll keep an eye out for a fix on that URI issue then. Is there an issue on the Neovim github that I can follow?

mjlbach commented 2 years ago