diff --git a/default.nix b/default.nix index ef94c0e..465a709 100644 --- a/default.nix +++ b/default.nix @@ -9,7 +9,7 @@ stdenv.mkDerivation rec { pname = "hoon-language-server"; - version = "1.1.0"; + version = "0.1.1"; nativeBuildInputs = [ nodejs @@ -44,7 +44,7 @@ stdenv.mkDerivation rec { cp -a . $out/share/hoon-language-server makeWrapper ${nodejs}/bin/node $out/bin/hoon-language-server \ - --add-flags $out/share/hoon-language-server/out/index.js + --add-flags $out/share/hoon-language-server/out/server.js runHook postInstall ''; diff --git a/hoon-language-server b/hoon-language-server deleted file mode 100755 index 539ca16..0000000 --- a/hoon-language-server +++ /dev/null @@ -1,200 +0,0 @@ -#!/usr/bin/env python3 - -# Adapted from: -# https://github.com/palantir/python-jsonrpc-server/blob/409eb0c/examples/langserver.py - -import requests -import json -import logging -import sys -import time - -from getopt import getopt, GetoptError -from pyls_jsonrpc import dispatchers, endpoint -from pyls_jsonrpc.streams import JsonRpcStreamReader, JsonRpcStreamWriter - -logging.basicConfig(level=logging.INFO, filename='/tmp/hoon-language-server.log', filemode='w') -log = logging.getLogger(__name__) - -defaultConfig = { - 'port': 8080, - 'delay': 0 -} - - -def bail(): - "Print usage string and bail" - print('usage: %s [-p port] [-d ms_delay]' % sys.argv[0]) - sys.exit(2) - -def get_config(): - "Parse command line args and return config" - try: - options, args = getopt(sys.argv[1:], 'p:d:', ['--port', '--delay']) - except GetoptError: - bail() - config = defaultConfig.copy() - for option, arg in options: - if option in ('-p', '--port'): - try: - config['port'] = int(arg) - except ValueError: - bail() - elif option in ('-d', '--delay'): - try: - config['delay'] = int(arg) - except ValueError: - bail() - else: - bail() - return config - - -def stdio(): - if sys.version_info >= (3, 0): - # pylint: disable=no-member - stdin, stdout = sys.stdin.buffer, sys.stdout.buffer - else: - stdin, stdout = sys.stdin, sys.stdout - - return stdin, stdout - - -class LanguageServer(dispatchers.MethodDispatcher): - """Implement a JSON RPC method dispatcher for the language server protocol.""" - - def __init__(self, rx, tx, config=defaultConfig): - # Endpoint is lazily set after construction - self._jsonrpc_stream_reader = JsonRpcStreamReader(rx) - self._jsonrpc_stream_writer = JsonRpcStreamWriter(tx) - self._endpoint = endpoint.Endpoint(self, - self._jsonrpc_stream_writer.write, max_workers=1) - self._base_url = 'http://localhost:' + str(config['port']) - data={'password': 'lidlut-tabwed-pillex-ridrup'} # fakezod - self._requests_session = requests.Session() - self._requests_session.post(self._base_url + '/~/login', data=data) - - def _hook(self, uri, data): - r = self._requests_session.post(self._base_url + '/~language-server-protocol', - data=json.dumps({'uri': uri, 'data': data})) - try: - log.info("good hook %s", r.json()) - return r.json() - except json.decoder.JSONDecodeError: - log.info("broked hook %s", r.text) - return None - - def start(self): - self._jsonrpc_stream_reader.listen(self._endpoint.consume) - - def m_initialize(self, rootUri=None, **kwargs): - log.info('Got initialize params: %s', kwargs) - return {'capabilities': { - 'hoverProvider': True, - 'textDocumentSync': { - 'openClose': True, - 'change': 2, # send incremental updates - 'willSave': True, - 'save': True - }, - 'definitionProvider': True, - 'completionProvider': { - 'resolveProvider': False, # We know everything ahead of time - 'triggerCharacters': [ - '-', '+', '^', '!', '@', '$', '%', '.', - '%', '&', '*', '/', ',', '>', '<', '~', - '|', '=', ';', ':', '_', - ] - }, - }} - - def m_initialized(self, **kwargs): - log.info("Got initialized params: %s", kwargs) - pass - - def m_shutdown(self, **kwargs): - log.info("Got shutdown request: %s", kwargs) - sys.exit(2) - - def m_text_document__hover(self, textDocument=None, position=None, **_kwargs): - log.info("Hovering on text document %s at: %s", textDocument['uri'], position) - log.info(position) - res = self._hook(textDocument['uri'], {'hover': position}) - log.info('hover responded: %s', res) - return res - - - def m_text_document__did_open(self, textDocument=None, **_kwargs): - log.info("Opened text document %s", textDocument['uri']) - log.info(self._hook( - textDocument['uri'], - {'sync': [{'text': textDocument['text']}]} - )) - - def m_text_document__will_save(self, textDocument=None, **_kwargs): - log.info("saving %s", textDocument['uri']) - # log.info(self._hook({'sync': textDocument['text']})) - - - def m_text_document__did_save(self, textDocument=None, **_kwargs): - log.info("saved %s", textDocument['uri']) - time.sleep(config['delay'] / 1000) # delay in ms - res = self._hook(textDocument['uri'], {'commit': 1}) - log.info("save res: %s", res) - if res['good']: - self._endpoint.notify('textDocument/publishDiagnostics', { - 'uri': textDocument['uri'], - 'diagnostics': [] - }) - else: - self._endpoint.notify('textDocument/publishDiagnostics', { - 'uri': textDocument['uri'], - 'diagnostics': res['diagnostics'] - }) - - - def m_text_document__did_change(self, textDocument=None, **_kwargs): - log.info("changing %s", textDocument['uri']) - log.info("diff: %s", _kwargs) - self._hook( - textDocument['uri'], - {'sync': _kwargs['contentChanges']} - ) - - def m_text_document__completion(self, textDocument=None, - position=None, **kwargs): - log.info("Got compl params: %s %s %s", textDocument, position, - kwargs) - res = self._hook(textDocument['uri'], {'completion': position}) - if res['good']: - self._endpoint.notify('textDocument/publishDiagnostics', { - 'uri': textDocument['uri'], - 'diagnostics': [] - }) - return res['result'] - else: - self._endpoint.notify('textDocument/publishDiagnostics', { - 'uri': textDocument['uri'], - 'diagnostics': res['diagnostics'] - }) - return None - - def m_text_document__definition(self, textDocument=None, - position=None, **kwargs): - log.info("Got def params: %s %s %s", textDocument, position, - kwargs) - return { - 'uri': textDocument['uri'], - 'range': { - 'start': { 'line': 1, 'character': '3' }, - 'end': { 'line': 1, 'character': '5' } - } - } - - -if __name__ == "__main__": - stdin, stdout = stdio() - config = get_config() - print(config) - server = LanguageServer(stdin,stdout, config) - server.start() diff --git a/node-packages.nix b/node-packages.nix index 42b1beb..72e2f33 100644 --- a/node-packages.nix +++ b/node-packages.nix @@ -4,15 +4,6 @@ let sources = { - "@types/events-3.0.0" = { - name = "_at_types_slash_events"; - packageName = "@types/events"; - version = "3.0.0"; - src = fetchurl { - url = "https://registry.npmjs.org/@types/events/-/events-3.0.0.tgz"; - sha512 = "EaObqwIvayI5a8dCzhFrjKzVwKLxjoG9T6Ppd5CEo07LRKfQ8Yokw54r5+Wq7FaBQ+yXRvQAYPrHwya1/UFt9g=="; - }; - }; "@types/eventsource-1.1.8" = { name = "_at_types_slash_eventsource"; packageName = "@types/eventsource"; @@ -40,15 +31,6 @@ let sha512 = "s3nugnZumCC//n4moGGe6tkNMyYEdaDBitVjwPxXmR5lnMG5dHePinH2EdxkG3Rh1ghFHHixAG4NJhpJW1rthQ=="; }; }; - "@types/pino-5.20.0" = { - name = "_at_types_slash_pino"; - packageName = "@types/pino"; - version = "5.20.0"; - src = fetchurl { - url = "https://registry.npmjs.org/@types/pino/-/pino-5.20.0.tgz"; - sha512 = "gz3Ahvx1UDEveXViOQtYqnUkjSVQFdoJqpZTW/63spEHwOGRJRJIi3JMJSClp5Sk1x1ljn9tHWjGczmP6s/rvg=="; - }; - }; "@types/yargs-15.0.14" = { name = "_at_types_slash_yargs"; packageName = "@types/yargs"; @@ -94,22 +76,13 @@ let sha512 = "kNOjDqAh7px0XWNI+4QbzoiR/nTkHAWNud2uvnJquD1/x5a7EQZMJT0AczqK0Qn67oY/TTQ1LbUKajZpp3I9tQ=="; }; }; - "camelcase-5.3.1" = { - name = "camelcase"; - packageName = "camelcase"; - version = "5.3.1"; - src = fetchurl { - url = "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz"; - sha512 = "L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg=="; - }; - }; - "cliui-6.0.0" = { + "cliui-7.0.4" = { name = "cliui"; packageName = "cliui"; - version = "6.0.0"; + version = "7.0.4"; src = fetchurl { - url = "https://registry.npmjs.org/cliui/-/cliui-6.0.0.tgz"; - sha512 = "t6wbgtoCXvAzst7QgXxJYqPt0usEfbgQdftEPbLL/cvv6HPE5VgvqCuAIDR0NgU52ds6rFwqrgakNLrHEjCbrQ=="; + url = "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz"; + sha512 = "OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ=="; }; }; "color-convert-2.0.1" = { @@ -130,13 +103,13 @@ let sha512 = "dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA=="; }; }; - "decamelize-1.2.0" = { - name = "decamelize"; - packageName = "decamelize"; - version = "1.2.0"; + "duplexify-4.1.2" = { + name = "duplexify"; + packageName = "duplexify"; + version = "4.1.2"; src = fetchurl { - url = "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz"; - sha1 = "f6534d15148269b20352e7bee26f501f9a191290"; + url = "https://registry.npmjs.org/duplexify/-/duplexify-4.1.2.tgz"; + sha512 = "fz3OjcNCHmRP12MJoZMPglx8m4rrFP8rovnk4vT8Fs+aonZoCwGg10dSsQsfP/E62eZcPTMSMP6686fu9Qlqtw=="; }; }; "emoji-regex-8.0.0" = { @@ -148,6 +121,24 @@ let sha512 = "MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A=="; }; }; + "end-of-stream-1.4.4" = { + name = "end-of-stream"; + packageName = "end-of-stream"; + version = "1.4.4"; + src = fetchurl { + url = "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz"; + sha512 = "+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q=="; + }; + }; + "escalade-3.1.1" = { + name = "escalade"; + packageName = "escalade"; + version = "3.1.1"; + src = fetchurl { + url = "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz"; + sha512 = "k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw=="; + }; + }; "eventsource-1.1.0" = { name = "eventsource"; packageName = "eventsource"; @@ -157,40 +148,13 @@ let sha512 = "VSJjT5oCNrFvCS6igjzPAt5hBzQ2qPBFIbJ03zLI9SE0mxwZpMw6BfJrbFHm1a141AavMEB8JHmBhWAd66PfCg=="; }; }; - "fast-redact-2.1.0" = { + "fast-redact-3.1.1" = { name = "fast-redact"; packageName = "fast-redact"; - version = "2.1.0"; - src = fetchurl { - url = "https://registry.npmjs.org/fast-redact/-/fast-redact-2.1.0.tgz"; - sha512 = "0LkHpTLyadJavq9sRzzyqIoMZemWli77K2/MGOkafrR64B9ItrvZ9aT+jluvNDsv0YEHjSNhlMBtbokuoqii4A=="; - }; - }; - "fast-safe-stringify-2.1.1" = { - name = "fast-safe-stringify"; - packageName = "fast-safe-stringify"; - version = "2.1.1"; - src = fetchurl { - url = "https://registry.npmjs.org/fast-safe-stringify/-/fast-safe-stringify-2.1.1.tgz"; - sha512 = "W+KJc2dmILlPplD/H4K9l9LcAHAfPtP6BY84uVLXQ6Evcz9Lcg33Y2z1IVblT6xdY54PXYVHEv+0Wpq8Io6zkA=="; - }; - }; - "find-up-4.1.0" = { - name = "find-up"; - packageName = "find-up"; - version = "4.1.0"; - src = fetchurl { - url = "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz"; - sha512 = "PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw=="; - }; - }; - "flatstr-1.0.12" = { - name = "flatstr"; - packageName = "flatstr"; - version = "1.0.12"; + version = "3.1.1"; src = fetchurl { - url = "https://registry.npmjs.org/flatstr/-/flatstr-1.0.12.tgz"; - sha512 = "4zPxDyhCyiN2wIAtSLI6gc82/EjqZc1onI4Mz/l0pWrAlsSfYH/2ZIcU+e3oA2wDwbzIWNKwa23F8rh6+DRWkw=="; + url = "https://registry.npmjs.org/fast-redact/-/fast-redact-3.1.1.tgz"; + sha512 = "odVmjC8x8jNeMZ3C+rPMESzXVSEU8tSWSHv9HFxP2mm89G/1WwqhrerJDQm9Zus8X6aoRgQDThKqptdNA6bt+A=="; }; }; "get-caller-file-2.0.5" = { @@ -202,6 +166,15 @@ let sha512 = "DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg=="; }; }; + "inherits-2.0.4" = { + name = "inherits"; + packageName = "inherits"; + version = "2.0.4"; + src = fetchurl { + url = "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz"; + sha512 = "k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ=="; + }; + }; "is-fullwidth-code-point-3.0.0" = { name = "is-fullwidth-code-point"; packageName = "is-fullwidth-code-point"; @@ -220,15 +193,6 @@ let sha512 = "RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ=="; }; }; - "locate-path-5.0.0" = { - name = "locate-path"; - packageName = "locate-path"; - version = "5.0.0"; - src = fetchurl { - url = "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz"; - sha512 = "t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g=="; - }; - }; "lodash-4.17.21" = { name = "lodash"; packageName = "lodash"; @@ -256,6 +220,24 @@ let sha1 = "2109adc7965887cfc05cbbd442cac8bfbb360863"; }; }; + "on-exit-leak-free-0.2.0" = { + name = "on-exit-leak-free"; + packageName = "on-exit-leak-free"; + version = "0.2.0"; + src = fetchurl { + url = "https://registry.npmjs.org/on-exit-leak-free/-/on-exit-leak-free-0.2.0.tgz"; + sha512 = "dqaz3u44QbRXQooZLTUKU41ZrzYrcvLISVgbrzbyCMxpmSLJvZ3ZamIJIZ29P6OhZIkNIQKosdeM6t1LYbA9hg=="; + }; + }; + "once-1.4.0" = { + name = "once"; + packageName = "once"; + version = "1.4.0"; + src = fetchurl { + url = "https://registry.npmjs.org/once/-/once-1.4.0.tgz"; + sha1 = "583b1aa775961d4b113ac17d9c50baef9dd76bd1"; + }; + }; "original-1.0.2" = { name = "original"; packageName = "original"; @@ -265,58 +247,40 @@ let sha512 = "hyBVl6iqqUOJ8FqRe+l/gS8H+kKYjrEndd5Pm1MfBtsEKA038HkkdbAl/72EAXGyonD/PFsvmVG+EvcIpliMBg=="; }; }; - "p-limit-2.3.0" = { - name = "p-limit"; - packageName = "p-limit"; - version = "2.3.0"; - src = fetchurl { - url = "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz"; - sha512 = "//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w=="; - }; - }; - "p-locate-4.1.0" = { - name = "p-locate"; - packageName = "p-locate"; - version = "4.1.0"; + "pino-7.9.2" = { + name = "pino"; + packageName = "pino"; + version = "7.9.2"; src = fetchurl { - url = "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz"; - sha512 = "R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A=="; + url = "https://registry.npmjs.org/pino/-/pino-7.9.2.tgz"; + sha512 = "c8wmB2PuhdJurYPRl/eo3+PosHe7Ep6GZvBJFIrp9oV1YRZQ3qm3MujaEolaKUfwX8cDL96WKCWWMedB2drXqw=="; }; }; - "p-try-2.2.0" = { - name = "p-try"; - packageName = "p-try"; - version = "2.2.0"; + "pino-abstract-transport-0.5.0" = { + name = "pino-abstract-transport"; + packageName = "pino-abstract-transport"; + version = "0.5.0"; src = fetchurl { - url = "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz"; - sha512 = "R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ=="; + url = "https://registry.npmjs.org/pino-abstract-transport/-/pino-abstract-transport-0.5.0.tgz"; + sha512 = "+KAgmVeqXYbTtU2FScx1XS3kNyfZ5TrXY07V96QnUSFqo2gAqlvmaxH67Lj7SWazqsMabf+58ctdTcBgnOLUOQ=="; }; }; - "path-exists-4.0.0" = { - name = "path-exists"; - packageName = "path-exists"; + "pino-std-serializers-4.0.0" = { + name = "pino-std-serializers"; + packageName = "pino-std-serializers"; version = "4.0.0"; src = fetchurl { - url = "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz"; - sha512 = "ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w=="; - }; - }; - "pino-5.17.0" = { - name = "pino"; - packageName = "pino"; - version = "5.17.0"; - src = fetchurl { - url = "https://registry.npmjs.org/pino/-/pino-5.17.0.tgz"; - sha512 = "LqrqmRcJz8etUjyV0ddqB6OTUutCgQULPFg2b4dtijRHUsucaAdBgSUW58vY6RFSX+NT8963F+q0tM6lNwGShA=="; + url = "https://registry.npmjs.org/pino-std-serializers/-/pino-std-serializers-4.0.0.tgz"; + sha512 = "cK0pekc1Kjy5w9V2/n+8MkZwusa6EyyxfeQCB799CQRhRt/CqYKiWs5adeu8Shve2ZNffvfC/7J64A2PJo1W/Q=="; }; }; - "pino-std-serializers-2.5.0" = { - name = "pino-std-serializers"; - packageName = "pino-std-serializers"; - version = "2.5.0"; + "process-warning-1.0.0" = { + name = "process-warning"; + packageName = "process-warning"; + version = "1.0.0"; src = fetchurl { - url = "https://registry.npmjs.org/pino-std-serializers/-/pino-std-serializers-2.5.0.tgz"; - sha512 = "wXqbqSrIhE58TdrxxlfLwU9eDhrzppQDvGhBEr1gYbzzM4KKo3Y63gSjiDXRKLVS2UOXdPNR2v+KnQgNrs+xUg=="; + url = "https://registry.npmjs.org/process-warning/-/process-warning-1.0.0.tgz"; + sha512 = "du4wfLyj4yCZq1VupnVSZmRsPJsNuxoDQFdCFHLaYiEbFBD7QE0a+I4D7hOxrVnh78QE/YipFAj9lXHiXocV+Q=="; }; }; "prop-types-15.8.1" = { @@ -337,13 +301,13 @@ let sha512 = "FIqgj2EUvTa7R50u0rGsyTftzjYmv/a3hO345bZNrqabNqjtgiDMgmo4mkUjd+nzU5oF3dClKqFIPUKybUyqoQ=="; }; }; - "quick-format-unescaped-3.0.3" = { + "quick-format-unescaped-4.0.4" = { name = "quick-format-unescaped"; packageName = "quick-format-unescaped"; - version = "3.0.3"; + version = "4.0.4"; src = fetchurl { - url = "https://registry.npmjs.org/quick-format-unescaped/-/quick-format-unescaped-3.0.3.tgz"; - sha512 = "dy1yjycmn9blucmJLXOfZDx1ikZJUi6E8bBZLnhPG5gBrVhHXx2xVyqqgKBubVNEXmx51dBACMHpoMQK/N/AXQ=="; + url = "https://registry.npmjs.org/quick-format-unescaped/-/quick-format-unescaped-4.0.4.tgz"; + sha512 = "tYC1Q1hgyRuHgloV/YXs2w15unPVh8qfu/qCTfhTYamaw7fyhumKa2yGpdSo87vY32rIclj+4fWYQXUMs9EHvg=="; }; }; "react-16.14.0" = { @@ -364,6 +328,24 @@ let sha512 = "24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ=="; }; }; + "readable-stream-3.6.0" = { + name = "readable-stream"; + packageName = "readable-stream"; + version = "3.6.0"; + src = fetchurl { + url = "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz"; + sha512 = "BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA=="; + }; + }; + "real-require-0.1.0" = { + name = "real-require"; + packageName = "real-require"; + version = "0.1.0"; + src = fetchurl { + url = "https://registry.npmjs.org/real-require/-/real-require-0.1.0.tgz"; + sha512 = "r/H9MzAWtrv8aSVjPCMFpDMl5q66GqtmmRkRjpHTsp4zBAa+snZyiQNlMONiUmEJcsnaw0wCauJ2GWODr/aFkg=="; + }; + }; "require-directory-2.1.1" = { name = "require-directory"; packageName = "require-directory"; @@ -373,15 +355,6 @@ let sha1 = "8c64ad5fd30dab1c976e2344ffe7f792a6a6df42"; }; }; - "require-main-filename-2.0.0" = { - name = "require-main-filename"; - packageName = "require-main-filename"; - version = "2.0.0"; - src = fetchurl { - url = "https://registry.npmjs.org/require-main-filename/-/require-main-filename-2.0.0.tgz"; - sha512 = "NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg=="; - }; - }; "requires-port-1.0.0" = { name = "requires-port"; packageName = "requires-port"; @@ -391,22 +364,49 @@ let sha1 = "925d2601d39ac485e091cf0da5c6e694dc3dcaff"; }; }; - "set-blocking-2.0.0" = { - name = "set-blocking"; - packageName = "set-blocking"; - version = "2.0.0"; + "safe-buffer-5.2.1" = { + name = "safe-buffer"; + packageName = "safe-buffer"; + version = "5.2.1"; + src = fetchurl { + url = "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz"; + sha512 = "rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ=="; + }; + }; + "safe-stable-stringify-2.3.1" = { + name = "safe-stable-stringify"; + packageName = "safe-stable-stringify"; + version = "2.3.1"; src = fetchurl { - url = "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz"; - sha1 = "045f9782d011ae9a6803ddd382b24392b3d890f7"; + url = "https://registry.npmjs.org/safe-stable-stringify/-/safe-stable-stringify-2.3.1.tgz"; + sha512 = "kYBSfT+troD9cDA85VDnHZ1rpHC50O0g1e6WlGHVCz/g+JS+9WKLj+XwFYyR8UbrZN8ll9HUpDAAddY58MGisg=="; }; }; - "sonic-boom-0.7.7" = { + "sonic-boom-2.6.0" = { name = "sonic-boom"; packageName = "sonic-boom"; - version = "0.7.7"; + version = "2.6.0"; + src = fetchurl { + url = "https://registry.npmjs.org/sonic-boom/-/sonic-boom-2.6.0.tgz"; + sha512 = "6xYZFRmDEtxGqfOKcDQ4cPLrNa0SPEDI+wlzDAHowXE6YV42NeXqg9mP2KkiM8JVu3lHfZ2iQKYlGOz+kTpphg=="; + }; + }; + "split2-4.1.0" = { + name = "split2"; + packageName = "split2"; + version = "4.1.0"; + src = fetchurl { + url = "https://registry.npmjs.org/split2/-/split2-4.1.0.tgz"; + sha512 = "VBiJxFkxiXRlUIeyMQi8s4hgvKCSjtknJv/LVYbrgALPwf5zSKmEwV9Lst25AkvMDnvxODugjdl6KZgwKM1WYQ=="; + }; + }; + "stream-shift-1.0.1" = { + name = "stream-shift"; + packageName = "stream-shift"; + version = "1.0.1"; src = fetchurl { - url = "https://registry.npmjs.org/sonic-boom/-/sonic-boom-0.7.7.tgz"; - sha512 = "Ei5YOo5J64GKClHIL/5evJPgASXFVpfVYbJV9PILZQytTK6/LCwHvsZJW2Ig4p9FMC2OrBrMnXKgRN/OEoAWfg=="; + url = "https://registry.npmjs.org/stream-shift/-/stream-shift-1.0.1.tgz"; + sha512 = "AiisoFqQ0vbGcZgQPY1cdP2I76glaVA/RauYR4G4thNFgkTqr90yXTo4LYX60Jl+sIlPNHHdGSwo01AvbKUSVQ=="; }; }; "string-width-4.2.3" = { @@ -418,6 +418,15 @@ let sha512 = "wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g=="; }; }; + "string_decoder-1.3.0" = { + name = "string_decoder"; + packageName = "string_decoder"; + version = "1.3.0"; + src = fetchurl { + url = "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz"; + sha512 = "hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA=="; + }; + }; "strip-ansi-6.0.1" = { name = "strip-ansi"; packageName = "strip-ansi"; @@ -427,6 +436,15 @@ let sha512 = "Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A=="; }; }; + "thread-stream-0.15.1" = { + name = "thread-stream"; + packageName = "thread-stream"; + version = "0.15.1"; + src = fetchurl { + url = "https://registry.npmjs.org/thread-stream/-/thread-stream-0.15.1.tgz"; + sha512 = "SCnuIT27gc2h/F/RY2peuC7brgLy+1oXU+7yOIAITz1z5stDpXCF5rAoFcykjuK6ifbTlKAHL7Ccq8oc5Btv1w=="; + }; + }; "typescript-3.9.10" = { name = "typescript"; packageName = "typescript"; @@ -454,6 +472,15 @@ let sha512 = "WypcfiRhfeUP9vvF0j6rw0J3hrWrw6iZv3+22h6iRMJ/8z1Tj6XfLP4DsUix5MhMPnXpiHDoKyoZ/bdCkwBCiQ=="; }; }; + "util-deprecate-1.0.2" = { + name = "util-deprecate"; + packageName = "util-deprecate"; + version = "1.0.2"; + src = fetchurl { + url = "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz"; + sha1 = "450d4dc9fa70de732762fbd2d4a28981419a0ccf"; + }; + }; "vscode-jsonrpc-4.0.0" = { name = "vscode-jsonrpc"; packageName = "vscode-jsonrpc"; @@ -499,49 +526,49 @@ let sha512 = "obtSWTlbJ+a+TFRYGaUumtVwb+InIUVI0Lu0VBUAPmj2cU5JutEXg3xUE0c2J5Tcy7h2DEKVJBFi+Y9ZSFzzPQ=="; }; }; - "which-module-2.0.0" = { - name = "which-module"; - packageName = "which-module"; - version = "2.0.0"; + "wrap-ansi-7.0.0" = { + name = "wrap-ansi"; + packageName = "wrap-ansi"; + version = "7.0.0"; src = fetchurl { - url = "https://registry.npmjs.org/which-module/-/which-module-2.0.0.tgz"; - sha1 = "d9ef07dce77b9902b8a3a8fa4b31c3e3f7e6e87a"; + url = "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz"; + sha512 = "YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q=="; }; }; - "wrap-ansi-6.2.0" = { - name = "wrap-ansi"; - packageName = "wrap-ansi"; - version = "6.2.0"; + "wrappy-1.0.2" = { + name = "wrappy"; + packageName = "wrappy"; + version = "1.0.2"; src = fetchurl { - url = "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-6.2.0.tgz"; - sha512 = "r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA=="; + url = "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz"; + sha1 = "b5243d8f3ec1aa35f1364605bc0d1036e30ab69f"; }; }; - "y18n-4.0.3" = { + "y18n-5.0.8" = { name = "y18n"; packageName = "y18n"; - version = "4.0.3"; + version = "5.0.8"; src = fetchurl { - url = "https://registry.npmjs.org/y18n/-/y18n-4.0.3.tgz"; - sha512 = "JKhqTOwSrqNA1NY5lSztJ1GrBiUodLMmIZuLiDaMRJ+itFd+ABVE8XBjOvIWL+rSqNDC74LCSFmlb/U4UZ4hJQ=="; + url = "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz"; + sha512 = "0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA=="; }; }; - "yargs-15.4.1" = { + "yargs-17.4.0" = { name = "yargs"; packageName = "yargs"; - version = "15.4.1"; + version = "17.4.0"; src = fetchurl { - url = "https://registry.npmjs.org/yargs/-/yargs-15.4.1.tgz"; - sha512 = "aePbxDmcYW++PaqBsJ+HYUFwCdv4LVvdnhBy78E57PIor8/OVvhMrADFFEDh8DHDFRv/O9i3lPhsENjO7QX0+A=="; + url = "https://registry.npmjs.org/yargs/-/yargs-17.4.0.tgz"; + sha512 = "WJudfrk81yWFSOkZYpAZx4Nt7V4xp7S/uJkX0CnxovMCt1wCE8LNftPpNuF9X/u9gN5nsD7ycYtRcDf2pL3UiA=="; }; }; - "yargs-parser-18.1.3" = { + "yargs-parser-21.0.1" = { name = "yargs-parser"; packageName = "yargs-parser"; - version = "18.1.3"; + version = "21.0.1"; src = fetchurl { - url = "https://registry.npmjs.org/yargs-parser/-/yargs-parser-18.1.3.tgz"; - sha512 = "o50j0JeToy/4K6OZcaQmW6lyXXKhq7csREXcDwk2omFPJEwUNOVtJKvmDr9EI1fAJZUyZcRF7kxGBWmRXudrCQ=="; + url = "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.0.1.tgz"; + sha512 = "9BK1jFpLzJROCI5TzwZL/TU4gqjK5xiHV/RfWLOahrjAko/e4DJkRDZQXfvqAsiZzzYhgAzbgz6lg48jcm4GLg=="; }; }; }; @@ -551,66 +578,69 @@ let version = "0.1.0"; src = ./.; dependencies = [ - sources."@types/events-3.0.0" sources."@types/eventsource-1.1.8" sources."@types/lodash-4.14.180" sources."@types/node-13.13.52" - sources."@types/pino-5.20.0" sources."@types/yargs-15.0.14" sources."@types/yargs-parser-21.0.0" sources."ansi-regex-5.0.1" sources."ansi-styles-4.3.0" sources."atomic-sleep-1.0.0" - sources."camelcase-5.3.1" - sources."cliui-6.0.0" + sources."cliui-7.0.4" sources."color-convert-2.0.1" sources."color-name-1.1.4" - sources."decamelize-1.2.0" + sources."duplexify-4.1.2" sources."emoji-regex-8.0.0" + sources."end-of-stream-1.4.4" + sources."escalade-3.1.1" sources."eventsource-1.1.0" - sources."fast-redact-2.1.0" - sources."fast-safe-stringify-2.1.1" - sources."find-up-4.1.0" - sources."flatstr-1.0.12" + sources."fast-redact-3.1.1" sources."get-caller-file-2.0.5" + sources."inherits-2.0.4" sources."is-fullwidth-code-point-3.0.0" sources."js-tokens-4.0.0" - sources."locate-path-5.0.0" sources."lodash-4.17.21" sources."loose-envify-1.4.0" sources."object-assign-4.1.1" + sources."on-exit-leak-free-0.2.0" + sources."once-1.4.0" sources."original-1.0.2" - sources."p-limit-2.3.0" - sources."p-locate-4.1.0" - sources."p-try-2.2.0" - sources."path-exists-4.0.0" - sources."pino-5.17.0" - sources."pino-std-serializers-2.5.0" + sources."pino-7.9.2" + sources."pino-abstract-transport-0.5.0" + sources."pino-std-serializers-4.0.0" + sources."process-warning-1.0.0" sources."prop-types-15.8.1" sources."querystringify-2.2.0" - sources."quick-format-unescaped-3.0.3" + sources."quick-format-unescaped-4.0.4" sources."react-16.14.0" sources."react-is-16.13.1" + sources."readable-stream-3.6.0" + sources."real-require-0.1.0" sources."require-directory-2.1.1" - sources."require-main-filename-2.0.0" sources."requires-port-1.0.0" - sources."set-blocking-2.0.0" - sources."sonic-boom-0.7.7" + sources."safe-buffer-5.2.1" + sources."safe-stable-stringify-2.3.1" + sources."sonic-boom-2.6.0" + sources."split2-4.1.0" + sources."stream-shift-1.0.1" sources."string-width-4.2.3" + sources."string_decoder-1.3.0" sources."strip-ansi-6.0.1" + sources."thread-stream-0.15.1" sources."typescript-3.9.10" sources."urbit-airlock-0.0.2" sources."url-parse-1.5.10" + sources."util-deprecate-1.0.2" sources."vscode-jsonrpc-4.0.0" sources."vscode-languageserver-5.2.1" sources."vscode-languageserver-protocol-3.14.1" sources."vscode-languageserver-types-3.14.0" sources."vscode-uri-1.0.8" - sources."which-module-2.0.0" - sources."wrap-ansi-6.2.0" - sources."y18n-4.0.3" - sources."yargs-15.4.1" - sources."yargs-parser-18.1.3" + sources."wrap-ansi-7.0.0" + sources."wrappy-1.0.2" + sources."y18n-5.0.8" + sources."yargs-17.4.0" + sources."yargs-parser-21.0.1" ]; buildInputs = globalBuildInputs; meta = { diff --git a/package.json b/package.json index 382aad0..1620ca9 100644 --- a/package.json +++ b/package.json @@ -1,35 +1,40 @@ { - "name": "@urbit/hoon-language-server", - "description": "LSP bridge for Hoon.", - "version": "0.1.0", - "author": "Tlon Corporation", - "license": "MIT", - "engines": { - "node": "*" - }, - "repository": { - "type": "git", - "url": "https://github.com/urbit/hoon-language-server" - }, - "bin": { - "hoon-language-server": "./bin/index.js" - }, - "dependencies": { - "@types/eventsource": "^1.1.5", - "@types/lodash": "^4.14.149", - "@types/node": "^13.1.1", - "@types/yargs": "^15.0.0", - "eventsource": "^1.0.7", - "lodash": "^4.17.21", - "pino": "^7.8.0", - "typescript": "^3.8.3", - "urbit-airlock": "0.0.2", - "vscode-languageserver": "^5.2.1", - "yargs": "^17.3.1" - }, - "scripts": { - "postinstall": "npm run build", - "build": "tsc", - "watch": "tsc --watch" - } + "name": "hoon-language-server", + "description": "LSP bridge for Hoon.", + "version": "0.1.0", + "author": "Tlon Corporation", + "license": "MIT", + "engines": { + "node": "*" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/urbit/hoon-language-server.git" + }, + "bin": { + "hoon-language-server": "bin/index.js" + }, + "dependencies": { + "@types/eventsource": "^1.1.5", + "@types/lodash": "^4.14.149", + "@types/node": "^13.1.1", + "@types/yargs": "^15.0.0", + "eventsource": "^1.0.7", + "lodash": "^4.17.21", + "pino": "^7.8.0", + "typescript": "^3.8.3", + "urbit-airlock": "0.0.2", + "vscode-languageserver": "^5.2.1", + "yargs": "^17.3.1" + }, + "scripts": { + "prepare": "npm run build", + "build": "tsc", + "watch": "tsc --watch" + }, + "bugs": { + "url": "https://github.com/urbit/hoon-language-server/issues" + }, + "homepage": "https://github.com/urbit/hoon-language-server#readme", + "main": "index.js" } diff --git a/setup.py b/setup.py deleted file mode 100644 index c0a8971..0000000 --- a/setup.py +++ /dev/null @@ -1,23 +0,0 @@ -import setuptools -with open("README.md", "r") as fh: - long_description = fh.read() -setuptools.setup( - name='hoon-language-server', - version='0.1.1', - scripts=['hoon-language-server'] , - author="Tlon", - author_email="philip@tlon.io", - description="Language Server for Hoon", - long_description=long_description, - long_description_content_type="text/markdown", - url="https://github.com/urbit/hoon-language-server", - packages=setuptools.find_packages(), - install_requires=[ - 'requests', - 'python-jsonrpc-server', - ], - classifiers=[ - "Programming Language :: Python :: 3", - "License :: OSI Approved :: MIT License", - ], - ) diff --git a/src/index.js b/src/index.js deleted file mode 100644 index cabc2c0..0000000 --- a/src/index.js +++ /dev/null @@ -1,2 +0,0 @@ -#!/usr/bin/env node -require('./server.js'); diff --git a/src/index.ts b/src/index.ts deleted file mode 100644 index 5c955b6..0000000 --- a/src/index.ts +++ /dev/null @@ -1,73 +0,0 @@ -/* -------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - * ------------------------------------------------------------------------------------------ */ - - -import * as rpc from 'vscode-jsonrpc'; - - -let connection = rpc.createMessageConnection( - new rpc.StreamMessageReader(process.stdin), - new rpc.StreamMessageWriter(process.stdout)); - -let notification = new rpc.NotificationType('testNotification'); -connection.onNotification( (method: string, params: any[]) => { - console.log(method); - console.log(params); // This prints Hello World -}); - -connection.onRequest((method: string, params: any[]) => { - console.log(method); - console.log(params); // This prints Hello World -}) - -connection.listen(); - -// import { -// createConnection, -// TextDocuments, -// TextDocument, -// Diagnostic, -// DiagnosticSeverity, -// ProposedFeatures, -// InitializeParams, -// DidChangeConfigurationNotification, -// CompletionItem, -// CompletionItemKind, -// TextDocumentPositionParams, -// RequestMessage -// } from 'vscode-languageserver'; - -// type ParsingLocation = "header" | "content" | "ready"; - -// process.stdin.setEncoding('utf-8'); - -// let messages: string[] = []; - - - -// let location: ParsingLocation = "header"; - -// function handleNewChunk(chunk: string) { - - -// } - -// process.stdin.on('readable', () => { -// let chunk; -// // Use a loop to make sure we read all available data. -// while ((chunk = process.stdin.read()) !== null) { -// handleNewChunk(chunk); -// messages.push(chunk) -// } -// console.log(messages); -// }); - -// process.on('exit', () => { -// console.log(messages) -// }) - -// process.stdin.on('end', () => { -// process.stdout.write('end'); -// }); diff --git a/src/server.ts b/src/server.ts index 669b039..daec4f3 100644 --- a/src/server.ts +++ b/src/server.ts @@ -11,7 +11,7 @@ import { connect } from "urbit-airlock/lib/setup"; import { wait, request, Config } from "./util"; const logger = pino( - { level: "trace" } + { level: "info" } ); interface RequestContinuation { @@ -26,12 +26,12 @@ class Server { subscription: number | null = null; outstandingRequests: Map = new Map(); constructor(private channel: Channel, private delay: number) { + logger.info('constructor'); this.connection = rpc.createMessageConnection( new rpc.StreamMessageReader(process.stdin), new rpc.StreamMessageWriter(process.stdout) ); - // this.connection.trace(rpc.Trace.Messages, tracer); - + this.connection.onNotification((method, params) => this.onNotification(method, params) ); @@ -90,6 +90,8 @@ class Server { serve() { // const onUpdate = // const onError = this.onSubscriptionErr.bind(this); + + logger.info('started'); this.channel.subscribe(app, path, { mark: "json", onError: (e: any) => this.onSubscriptionErr(e), @@ -102,7 +104,6 @@ class Server { // handlers onNotification(method: string, params: any[]) { - logger.debug({ method, params }); if (method === "textDocument/didSave") { wait(this.delay).then(() => { logger.debug("Delayed didSave"); @@ -113,6 +114,7 @@ class Server { } onRequest(method: string, params: any[]) { + logger.info({ message: `caught request`, method }); const id = uniqueId(); if (method === "initialize") {