Code Monkey home page Code Monkey logo

Comments (13)

keplersj avatar keplersj commented on June 7, 2024 1

I don't think this is technically an issue with scry. I think this issue falls on intellij-lsp. It looks to me that intellij-lsp is not in compliance with the protocol. Once they are compliant scry should work.

from scry.

kofno avatar kofno commented on June 7, 2024 1

Is it true that this isn't a scry problem? Which part of that message are we failing on? According to the 3.0 spec, many of those fields (hover, etc) should be optional. Which means the intellij message may be valid and scry isn't compliant.

from scry.

faustinoaq avatar faustinoaq commented on June 7, 2024

/cc @crystal-lang-tools/scry

from scry.

faustinoaq avatar faustinoaq commented on June 7, 2024

Seems the initialize message sended by intellij-idea client is a bit different:

  1. Message sent by a working client (VSCode)
{
    "jsonrpc": "2.0",
    "id": 0,
    "method": "initialize",
    "params": {
        "processId": 8075,
        "rootPath": "/home/main/Projects/console",
        "rootUri": "file:///home/main/Projects/console",
        "capabilities": {
            "workspace": {
                "didChangeConfiguration": {
                    "dynamicRegistration": true
                },
                "didChangeWatchedFiles": {
                    "dynamicRegistration": true
                },
                "symbol": {
                    "dynamicRegistration": true
                },
                "executeCommand": {
                    "dynamicRegistration": true
                }
            },
            "textDocument": {
                "synchronization": {
                    "dynamicRegistration": true,
                    "willSave": true,
                    "willSaveWaitUntil": true,
                    "didSave": true
                },
                "completion": {
                    "dynamicRegistration": true,
                    "completionItem": {
                        "snippetSupport": true
                    }
                },
                "hover": {
                    "dynamicRegistration": true
                },
                "signatureHelp": {
                    "dynamicRegistration": true
                },
                "definition": {
                    "dynamicRegistration": true
                },
                "references": {
                    "dynamicRegistration": true
                },
                "documentHighlight": {
                    "dynamicRegistration": true
                },
                "documentSymbol": {
                    "dynamicRegistration": true
                },
                "codeAction": {
                    "dynamicRegistration": true
                },
                "codeLens": {
                    "dynamicRegistration": true
                },
                "formatting": {
                    "dynamicRegistration": true
                },
                "rangeFormatting": {
                    "dynamicRegistration": true
                },
                "onTypeFormatting": {
                    "dynamicRegistration": true
                },
                "rename": {
                    "dynamicRegistration": true
                },
                "documentLink": {
                    "dynamicRegistration": true
                }
            }
        },
        "trace": "off"
    }
}
  1. Message sent by intellij LSP client (extracted from this issue)
{
    "jsonrpc": "2.0",
    "id": "1",
    "method": "initialize",
    "params": {
        "rootUri": "file:///api_v2/",
        "capabilities": {
            "workspace": {
                "applyEdit": true,
                "workspaceEdit": {
                    "documentChanges": true
                },
                "didChangeWatchedFiles": {},
                "symbol": {},
                "executeCommand": {}
            },
            "textDocument": {
                "synchronization": {
                    "willSave": true,
                    "willSaveWaitUntil": true,
                    "didSave": true
                },
                "completion": {
                    "completionItem": {
                        "snippetSupport": false
                    }
                },
                "hover": {},
                "signatureHelp": {},
                "references": {},
                "documentHighlight": {},
                "formatting": {},
                "rangeFormatting": {},
                "onTypeFormatting": {},
                "definition": {},
                "codeAction": {},
                "rename": {}
            }
        }
    }
}

from scry.

keplersj avatar keplersj commented on June 7, 2024

/cc @gtache

from scry.

keplersj avatar keplersj commented on June 7, 2024

@kofno I think you're right, looking back it it.

Here's the TypeScript definition in the spec for hover:

       /**
	 * Capabilities specific to the `textDocument/hover`
	 */
	hover?: {
		/**
		 * Whether hover supports dynamic registration.
		 */
		dynamicRegistration?: boolean;

		/**
		 * Client supports the follow content formats for the content
		 * property. The order describes the preferred format of the client.
		 */
		contentFormat?: MarkupKind[];
	};

Given this it looks like valid values for the hover field would include hover: undefined, hover: null, hover: {}, and hover: { dynamicRegistration: true }.

from scry.

kofno avatar kofno commented on June 7, 2024

@keplersj agreed. We should fix.

from scry.

keplersj avatar keplersj commented on June 7, 2024

So I just went to see how we've mapped the schema for capabilities and we have capabilities mapped to JSON::Any

https://github.com/crystal-lang-tools/scry/blob/master/src/scry/protocol/initialize_params.cr#L8

So I'm not so sure capabilities is the problem anymore. It looks like our mapping of processId and rootPath is incorrect.

        /**
	 * The process Id of the parent process that started
	 * the server. Is null if the process has not been started by another process.
	 * If the parent process is not alive then the server should exit (see exit notification) its process.
	 */
	processId: number | null;

	/**
	 * The rootPath of the workspace. Is null
	 * if no folder is open.
	 *
	 * @deprecated in favour of rootUri.
	 */
	rootPath?: string | null;

https://github.com/crystal-lang-tools/scry/blob/master/src/scry/protocol/initialize_params.cr#L6-L7

from scry.

faustinoaq avatar faustinoaq commented on June 7, 2024

Hi @Blacksmoke16 We merged a PR to fix InitializeParams 🎉

Can you test it again in your Intellij-Idea IDE?

You will need to compile scry from master branch, try this:

git clone https://github.com/crystal-lang-tools/scry.git
cd scry
mkdir bin
crystal build --status --progress src/scry.cr -o bin/scry

from scry.

malte-v avatar malte-v commented on June 7, 2024

Any updates on this?

from scry.

Blacksmoke16 avatar Blacksmoke16 commented on June 7, 2024

Oh I totally forgot about this. I can check it when i get home tonight.

from scry.

Blacksmoke16 avatar Blacksmoke16 commented on June 7, 2024

@faustinoaq @maltevoos I tried this again but same error. I used the latest release binary. I don't remember where the logs for this get outputted to tho....

from scry.

malte-v avatar malte-v commented on June 7, 2024

@Blacksmoke16 Sorry, I meant to ask the devs if they could look into this once more because I had the same issue with the latest release.

from scry.

Related Issues (20)

Recommend Projects

  • React photo React

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

  • Vue.js photo Vue.js

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

  • Typescript photo Typescript

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

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

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

Recommend Topics

  • javascript

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

  • web

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

  • server

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

  • Machine learning

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

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

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

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.