Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

After upgrade to v0.8.0 the plugin doesn't work #34

Closed
toretto460 opened this issue Nov 9, 2017 · 3 comments
Closed

After upgrade to v0.8.0 the plugin doesn't work #34

toretto460 opened this issue Nov 9, 2017 · 3 comments

Comments

@toretto460
Copy link

After the v0.8.0 update the cmd+click and go to definition does not work properly

My configuration is

{
    "window.zoomLevel": 0,
    "gitlens.blame.line.enabled": false,
    "editor.fontSize": 14,
    "files.autoSave": "afterDelay",
    "editor.letterSpacing": 0,
    "php.suggest.basic": false,
    "gitlens.codeLens.recentChange.enabled": false,
    "gitlens.codeLens.enabled": false,
    "extensions.ignoreRecommendations": false,
    "go.formatTool": "gofmt",
    "editor.wordWrap": "on",
    "editor.minimap.enabled": false,
    "editor.fontWeight": "normal",
    "editor.fontFamily": "Monaco, 'Courier New', monospace",
    "workbench.colorTheme": "Base16 Dark Tomorrow",
    "intelephense.trace.server": "verbose",
    "intelephense.debug.enable": true,
    "emmet.showExpandedAbbreviation": "never"
}

Here a trace example

[Trace - 10:55:57] Sending request 'textDocument/definition - (23723)'.
Params: {
    "textDocument": {
        "uri": "file:///{removed path}CampaignCreator.php"
    },
    "position": {
        "line": 93,
        "character": 38
    }
}


[Trace - 10:55:57] Received notification 'window/logMessage'.
Params: {
    "type": 4,
    "message": "[Debug - 10:55:57] onDefinition | file:///{removed path}CampaignCreator.php | {\"line\":93,\"character\":38} | 0.009 ms | 83.7 MB"
}


[Debug - 10:55:57] onDefinition | file:///{removed path}CampaignCreator.php | {"line":93,"character":38} | 0.009 ms | 83.7 MB
[Trace - 10:55:57] Received response 'textDocument/definition - (23723)' in 2ms.
No result returned.


[Trace - 10:55:57] Sending request 'documentLanguageRanges - (23724)'.
Params: {
    "textDocument": {
        "uri": "file:///{removed path}CampaignCreator.php"
    }
}


[Trace - 10:55:57] Received notification 'window/logMessage'.
Params: {
    "type": 4,
    "message": "[Debug - 10:55:57] onDocumentLanguageRanges | 0.006 ms | 83.7 MB"
}


[Debug - 10:55:57] onDocumentLanguageRanges | 0.006 ms | 83.7 MB
[Trace - 10:55:57] Received response 'documentLanguageRanges - (23724)' in 1ms.
No result returned.


[Trace - 10:55:57] Sending request 'textDocument/hover - (23725)'.
Params: {
    "textDocument": {
        "uri": "file:///{removed path}CampaignCreator.php"
    },
    "position": {
        "line": 93,
        "character": 38
    }
}


[Trace - 10:55:57] Received response 'textDocument/hover - (23725)' in 1ms.
No result returned.


[Trace - 10:55:57] Sending request 'documentLanguageRanges - (23726)'.
Params: {
    "textDocument": {
        "uri": "file:///{removed path}CampaignCreator.php"
    }
}


[Trace - 10:55:57] Received notification 'window/logMessage'.
Params: {
    "type": 4,
    "message": "[Debug - 10:55:57] onDocumentLanguageRanges | 0.006 ms | 83.7 MB"
}


[Debug - 10:55:57] onDocumentLanguageRanges | 0.006 ms | 83.7 MB
[Trace - 10:55:57] Received response 'documentLanguageRanges - (23726)' in 2ms.
No result returned.


[Trace - 10:55:58] Sending request 'textDocument/documentHighlight - (23727)'.
Params: {
    "textDocument": {
        "uri": "file:///{removed path}CampaignCreator.php"
    },
    "position": {
        "line": 93,
        "character": 38
    }
}


[Trace - 10:55:58] Received response 'textDocument/documentHighlight - (23727)' in 2ms.
No result returned.


[Trace - 10:55:58] Sending request 'documentLanguageRanges - (23728)'.
Params: {
    "textDocument": {
        "uri": "file:///{removed path}CampaignCreator.php"
    }
}


[Trace - 10:55:58] Received notification 'window/logMessage'.
Params: {
    "type": 4,
    "message": "[Debug - 10:55:58] onDocumentLanguageRanges | 0.005 ms | 83.8 MB"
}


[Debug - 10:55:58] onDocumentLanguageRanges | 0.005 ms | 83.8 MB
[Trace - 10:55:58] Received response 'documentLanguageRanges - (23728)' in 3ms.
No result returned.


[Trace - 10:55:58] Sending request 'textDocument/definition - (23729)'.
Params: {
    "textDocument": {
        "uri": "file:///{removed path}CampaignCreator.php"
    },
    "position": {
        "line": 93,
        "character": 38
    }
}


[Trace - 10:55:58] Received notification 'window/logMessage'.
Params: {
    "type": 4,
    "message": "[Debug - 10:55:58] onDefinition | file:///{removed path}CampaignCreator.php | {\"line\":93,\"character\":38} | 0.016 ms | 83.8 MB"
}


[Debug - 10:55:58] onDefinition | file:///{removed path}CampaignCreator.php | {"line":93,"character":38} | 0.016 ms | 83.8 MB
[Trace - 10:55:58] Received response 'textDocument/definition - (23729)' in 1ms.
No result returned.


[Trace - 10:55:58] Sending request 'documentLanguageRanges - (23730)'.
Params: {
    "textDocument": {
        "uri": "file:///{removed path}CampaignCreator.php"
    }
}


[Trace - 10:55:58] Received notification 'window/logMessage'.
Params: {
    "type": 4,
    "message": "[Debug - 10:55:58] onDocumentLanguageRanges | 0.006 ms | 83.8 MB"
}


[Debug - 10:55:58] onDocumentLanguageRanges | 0.006 ms | 83.8 MB
[Trace - 10:55:58] Received response 'documentLanguageRanges - (23730)' in 2ms.
No result returned.

I found also an error

SyntaxError: Unexpected end of JSON input
    at JSON.parse (<anonymous>)
    at fs.readFile (/Users/***/.vscode/extensions/bmewburn.vscode-intelephense-client-0.8.0/server/node_modules/intelephense/lib/cache.js:68:26)
    at /Users/***/.vscode/extensions/bmewburn.vscode-intelephense-client-0.8.0/server/node_modules/graceful-fs/graceful-fs.js:78:16
    at FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:439:3)
[Info  - 11:41:09] Connection to server got closed. Server will restart.
[Warn  - 11:41:09] Error: Connection got disposed.
[Warn  - 11:41:09] Error: Connection got disposed.
[Warn  - 11:41:09] Error: Language client is not ready yet
[Warn  - 11:41:09] Error: Language client is not ready yet
[Info  - 11:41:10] Initialising
[Info  - 11:41:12] Initialised in 2155 ms
@bmewburn
Copy link
Owner

bmewburn commented Nov 9, 2017

Thanks for reporting, could you provide a small snippet of code showing the symbol you tried to find definition of?

@toretto460
Copy link
Author

After the upgrade the plugin seems to have strange behaviour.
If I restart vscode the go to definition works for a while but after some minutes it stops working..

Here an example of code, the doApiRequestWithTimeout is the internal method where the plugin don't find the definition

    /**
     * Returns post data by id
     * matadata=1 is used for requests using POSTID format, because type field wasn't returned.
     *
     * @param string $id
     * @param array  $options
     *
     * @return array
     */
    public function findPostById($id, $options = [])
    {
        $queryString = $options ? '?'.http_build_query($options) : '';
        $url = sprintf('%s%s', $id, $queryString);

        $data = $this->doApiRequestWithTimeout($url, 'GET');

        if (isset($data['metadata']['type'])) {
            $data['type'] = $data['metadata']['type'];
        }

        return $data;
    }

    public function doApiRequestWithTimeout($url, $method = 'GET')
    {
        $retry = $this->options['retry_num'];
        $timeout = $this->options['retry_timeout'];
        $accessToken = $this->getAccessToken();

        while (true) {
            try {
                return $this->wrapper->sendRequest(
                    $url,
                    $method,
                    $params,
                    $apiVersion
                );
            } catch (ApiException $e) {
                //...
            }
        }
    }

@bmewburn
Copy link
Owner

resolved in v0.8.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants