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

How to configure intelephense #17

Closed
JoyceBabu opened this issue Feb 19, 2020 · 16 comments
Closed

How to configure intelephense #17

JoyceBabu opened this issue Feb 19, 2020 · 16 comments

Comments

@JoyceBabu
Copy link

How can I add an path to the file exclusions list in intelephense?

In COC / VS Code we have to use

"intelephense.files.exclude": [
        "**/.js",
        "**/.png",
        "**/.jpg",
        "**/.css",
        "**/.pdf",
        "**/.txt",
        "**/Volume/aaa/**",
        "**/Volume/bbb/**"
],

But as per #10, we have to use

            "files": {
                "exlude": [
                    "**/branch-*/**",
                ],
            },

I tried excluding all files by setting it to **/** and neither worked for me.

@jfcherng
Copy link
Collaborator

jfcherng commented Feb 19, 2020

Ah, I have a typo on that. It should be exclude.

** should work because it's used in its default settings
https://github.com/bmewburn/vscode-intelephense/blob/ff4677f07cb47911852fb265fe16742a312bd9b7/package.json#L112-L129

@JoyceBabu
Copy link
Author

JoyceBabu commented Feb 19, 2020

I fixed the typo, but it is still indexing all files.

I believe it is a conflict with the intelephense server installed by Coc. To be sure, I exited all instances of vim and sublime text, and killed all running node processes.

But as soon as I Sublime Text 3, the following two processes are starting

joyce            11409   0.0  0.1  4925944  22732   ??  S     4:45PM   0:00.06 /usr/local/Cellar/node/13.8.0/bin/node /Users/joyce/.config/coc/extensions/node_modules/coc-highlight/lib/server.js --node-ipc --node-ipc --clientProcessId=11406
joyce            11406   0.0  0.2  5440936  60208   ??  Ss    4:45PM   0:00.42 /usr/local/bin/node --no-warnings /Users/joyce/.local/share/nvim/plugged/coc.nvim/build/index.js

When I close Sublime Text, the above processes too disappear.

Update: Sorry, I had ActualVim plugin installed, which was starting a vim instance on sublime load.

@JoyceBabu
Copy link
Author

Intelephense server is running, but I cannot find any node processes running in ps aux output.

@jfcherng
Copy link
Collaborator

jfcherng commented Feb 19, 2020

In my test, that config does work though.

image

Before I open MyClassExclude.php manually, it's not indexed.

@jfcherng
Copy link
Collaborator

jfcherng commented Mar 29, 2020

btw, now in the latest lsp-intelephense 0.0.11, you have to use something like

https://github.com/jfcherng/my-Sublime-Text-settings/blob/bef185c8e3dc953e90ef2415676ceef83b416f79/Packages/User/LSP-intelephense.sublime-settings#L19-L54

        // @see https://github.com/bmewburn/vscode-intelephense/blob/master/package.json
	"settings": {
		"intelephense": {
			"files": {
				"exclude": [
					"**/.js",
					"**/.png",
					"**/.jpg",
					"**/.css",
					"**/.pdf",
					"**/.txt",
					"**/Volume/aaa/**",
					"**/Volume/bbb/**",
				],
			},
		},
	},

@antonpresn
Copy link

Hello! I've configured lsp-intelephence like this:

{
    "settings":
    {
        "debug":
        {
            "enable": false,
        },

        "intelephense":
        {
            "environment":
            {
                "documentRoot": "/var/www/html/myproject/",
                "phpVersion": "7.3.0"
            },
            "diagnostics":
            {
                "undefinedConstants": false,
                "undefinedFunctions": false,
                "undefinedSymbols": false
            },
            "files":
            {
                "associations": [
                    "*.php",
                    "*.phtml",
                    "*.inc"
                ],
                "exclude": [
                    "**/.git/**",
                    "**/.svn/**",
                    "**/.hg/**",
                    "**/CVS/**",
                    "**/.DS_Store/**",
                    "**/node_modules/**",
                    "**/bower_components/**",
                    "**/vendor/**/{Tests,tests}/**",
                    "/var/**",
                    "/framework/**",
                     "**/vendor/**/{Example,example,Examples,examples}/**"
                ]
            },
            "trace":
            {
                "server": "off"
            }
        }
    }

}

and it indexes ony the current file which I work with

there is debug log

:: --> lsp-intelephense initialize(1): {'capabilities': {'workspace': {'applyEdit': True, 'executeCommand': {}, 'configuration': True, 'symbol': {'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]}}, 'didChangeConfiguration': {}, 'workspaceFolders': True}, 'textDocument': {'publishDiagnostics': {'relatedInformation': True}, 'hover': {'contentFormat': ['markdown', 'plaintext']}, 'declaration': {'linkSupport': True}, 'documentHighlight': {}, 'codeAction': {'codeActionLiteralSupport': {'codeActionKind': {'valueSet': []}}}, 'rangeFormatting': {}, 'formatting': {}, 'signatureHelp': {'signatureInformation': {'parameterInformation': {'labelOffsetSupport': True}, 'documentationFormat': ['markdown', 'plaintext']}}, 'definition': {'linkSupport': True}, 'colorProvider': {}, 'typeDefinition': {'linkSupport': True}, 'references': {}, 'synchronization': {'willSaveWaitUntil': True, 'didSave': True, 'willSave': True}, 'rename': {}, 'documentSymbol': {'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]}}, 'completion': {'completionItem': {'snippetSupport': True}, '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]}}, 'implementation': {'linkSupport': True}}}, 'rootUri': 'file:///var/www/html/myproject', 'initializationOptions': {'clearCache': False}, 'processId': 648292, 'rootPath': '/var/www/html/myproject', 'workspaceFolders': [{'uri': 'file:///var/www/html/myproject', 'name': 'myproject'}]}
intelephense-ls: Initialising intelephense 1.3.11
lsp-intelephense: Reading state from /tmp/intelephense/55ada3ba.
:: --> intelephense-ls initialize(1): {'capabilities': {'workspace': {'applyEdit': True, 'executeCommand': {}, 'configuration': True, 'symbol': {'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]}}, 'didChangeConfiguration': {}, 'workspaceFolders': True}, 'textDocument': {'publishDiagnostics': {'relatedInformation': True}, 'hover': {'contentFormat': ['markdown', 'plaintext']}, 'declaration': {'linkSupport': True}, 'documentHighlight': {}, 'codeAction': {'codeActionLiteralSupport': {'codeActionKind': {'valueSet': []}}}, 'rangeFormatting': {}, 'formatting': {}, 'signatureHelp': {'signatureInformation': {'parameterInformation': {'labelOffsetSupport': True}, 'documentationFormat': ['markdown', 'plaintext']}}, 'definition': {'linkSupport': True}, 'colorProvider': {}, 'typeDefinition': {'linkSupport': True}, 'references': {}, 'synchronization': {'willSaveWaitUntil': True, 'didSave': True, 'willSave': True}, 'rename': {}, 'documentSymbol': {'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]}}, 'completion': {'completionItem': {'snippetSupport': True}, '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]}}, 'implementation': {'linkSupport': True}}}, 'rootUri': 'file:///var/www/html/myproject', 'initializationOptions': {'storagePath': None}, 'processId': 648292, 'rootPath': '/var/www/html/myproject', 'workspaceFolders': [{'uri': 'file:///var/www/html/myproject', 'name': 'myproject'}]}
intelephense-ls: Reading state from /tmp/intelephense/28310cab.
lsp-intelephense: Initialised in 170 ms
intelephense-ls: Initialised in 1583 ms
lsp-intelephense: Registering request handler for workspace/didChangeWorkspaceFolders failed.
intelephense-ls: Registering request handler for workspace/didChangeWorkspaceFolders failed.
lsp-intelephense: (node:648302) UnhandledPromiseRejectionWarning: Error: client/registerCapability
intelephense-ls: (node:648311) UnhandledPromiseRejectionWarning: Error: client/registerCapability
lsp-intelephense: at /home/admin/.config/sublime-text-3/Cache/LSP-intelephense/intelephense/node_modules/intelephense/lib/intelephense.js:59:146893
intelephense-ls: at /home/admin/.nvm/versions/node/v12.8.0/lib/node_modules/intelephense/lib/intelephense.js:59:146893
lsp-intelephense: at /home/admin/.config/sublime-text-3/Cache/LSP-intelephense/intelephense/node_modules/intelephense/lib/intelephense.js:59:147187
intelephense-ls: at /home/admin/.nvm/versions/node/v12.8.0/lib/node_modules/intelephense/lib/intelephense.js:59:147187
lsp-intelephense: at Immediate.<anonymous> (/home/admin/.config/sublime-text-3/Cache/LSP-intelephense/intelephense/node_modules/intelephense/lib/intelephense.js:59:147548)
intelephense-ls: at Immediate.<anonymous> (/home/admin/.nvm/versions/node/v12.8.0/lib/node_modules/intelephense/lib/intelephense.js:59:147548)
lsp-intelephense: at processImmediate (internal/timers.js:439:21)
lsp-intelephense: (node:648302) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)
intelephense-ls: at processImmediate (internal/timers.js:439:21)
lsp-intelephense: (node:648302) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
intelephense-ls: (node:648311) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)
intelephense-ls: (node:648311) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
lsp-intelephense: Indexing started.
intelephense-ls: Indexing started.
intelephense-ls: Indexing ended. 1 files indexed in 0s.
intelephense-ls: Writing state to /tmp/intelephense/28310cab.
lsp-intelephense: Indexing ended. 96 files indexed in 1s.
lsp-intelephense: Writing state to /tmp/intelephense/55ada3ba.
lsp-intelephense: Wrote state in 0.2s.
intelephense-ls: Wrote state in 2.0s.
:: <<< lsp-intelephense 1: {'capabilities': {'textDocumentSync': 2, 'workspace': {'workspaceFolders': {'supported': True, 'changeNotifications': True}}, 'foldingRangeProvider': False, 'renameProvider': False, 'documentRangeFormattingProvider': True, 'referencesProvider': True, 'declarationProvider': False, 'documentHighlightProvider': True, 'definitionProvider': True, 'signatureHelpProvider': {'triggerCharacters': ['(', ',']}, 'documentFormattingProvider': True, 'completionProvider': {'resolveProvider': True, 'triggerCharacters': ['$', '>', ':', '\\', '/', '*', '.', '<']}, 'implementationProvider': False, 'workspaceSymbolProvider': True, 'typeDefinitionProvider': False, 'hoverProvider': True, 'documentSymbolProvider': True}}
::  -> lsp-intelephense workspace/didChangeConfiguration: {'settings': {'debug': {'enable': False}, 'intelephense': {'diagnostics': {'undefinedFunctions': True, 'undefinedConstants': True, 'undefinedSymbols': True}, 'environment': {'documentRoot': '/var/www/html/myproject', 'phpVersion': '7.3.0'}, 'files': {'exclude': ['**/.git/**', '**/.svn/**', '**/.hg/**', '**/CVS/**', '**/.DS_Store/**', '**/node_modules/**', '**/bower_components/**', '**/vendor/**/{Tests,tests}/**', '/var/**', '/framework/**', '**/vendor/**/{Example,example,Examples,examples}/**'], 'associations': ['*.php', '*.phtml', '*.inc']}, 'trace': {'server': 'off'}}}}
::  -> lsp-intelephense initialized: {}
:: <<< intelephense-ls 1: {'capabilities': {'textDocumentSync': 2, 'workspace': {'workspaceFolders': {'supported': True, 'changeNotifications': True}}, 'foldingRangeProvider': False, 'renameProvider': False, 'documentRangeFormattingProvider': True, 'referencesProvider': True, 'declarationProvider': False, 'documentHighlightProvider': True, 'definitionProvider': True, 'signatureHelpProvider': {'triggerCharacters': ['(', ',']}, 'documentFormattingProvider': True, 'completionProvider': {'resolveProvider': True, 'triggerCharacters': ['$', '>', ':', '\\', '/', '*', '.', '<']}, 'implementationProvider': False, 'workspaceSymbolProvider': True, 'typeDefinitionProvider': False, 'hoverProvider': True, 'documentSymbolProvider': True}}
::  -> intelephense-ls initialized: {}
::  -> lsp-intelephense textDocument/didOpen
::  -> lsp-intelephense textDocument/didOpen
::  -> intelephense-ls textDocument/didOpen
::  -> intelephense-ls textDocument/didOpen
:: <-- lsp-intelephense client/registerCapability(0): {'registrations': [{'method': 'workspace/didChangeWorkspaceFolders', 'registerOptions': {}, 'id': '6cf24127-1326-4c9a-8668-22a6606e289e'}]}
:: ~~> lsp-intelephense 0: {'code': -32601, 'message': 'client/registerCapability'}
:: <-- lsp-intelephense workspace/configuration(1): {'items': [{'section': 'intelephense'}, {'section': 'intelephense', 'scopeUri': 'file:///var/www/html/myproject'}]}
:: >>> lsp-intelephense 1: [{'diagnostics': {'undefinedFunctions': True, 'undefinedConstants': True, 'undefinedSymbols': True}, 'environment': {'documentRoot': '/var/www/html/myproject', 'phpVersion': '7.3.0'}, 'files': {'exclude': ['**/.git/**', '**/.svn/**', '**/.hg/**', '**/CVS/**', '**/.DS_Store/**', '**/node_modules/**', '**/bower_components/**', '**/vendor/**/{Tests,tests}/**', '/var/**', '/framework/**', '**/vendor/**/{Example,example,Examples,examples}/**'], 'associations': ['*.php', '*.phtml', '*.inc']}, 'trace': {'server': 'off'}}, {'diagnostics': {'undefinedFunctions': True, 'undefinedConstants': True, 'undefinedSymbols': True}, 'environment': {'documentRoot': '/var/www/html/myproject', 'phpVersion': '7.3.0'}, 'files': {'exclude': ['**/.git/**', '**/.svn/**', '**/.hg/**', '**/CVS/**', '**/.DS_Store/**', '**/node_modules/**', '**/bower_components/**', '**/vendor/**/{Tests,tests}/**', '/var/**', '/framework/**',  '**/vendor/**/{Example,example,Examples,examples}/**'], 'associations': ['*.php', '*.phtml', '*.inc']}, 'trace': {'server': 'off'}}]
:: <-- intelephense-ls client/registerCapability(0): {'registrations': [{'method': 'workspace/didChangeWorkspaceFolders', 'registerOptions': {}, 'id': '06029b36-6d63-45e6-bbf4-def8a306bb38'}]}
:: ~~> intelephense-ls 0: {'code': -32601, 'message': 'client/registerCapability'}
:: <-- intelephense-ls workspace/configuration(1): {'items': [{'section': 'intelephense'}, {'section': 'intelephense', 'scopeUri': 'file:///var/www/html/myproject'}]}
:: >>> intelephense-ls 1: [None, None]
:: <-  lsp-intelephense textDocument/publishDiagnostics: {'uri': 'file:///var/www/html/myproject/classes/XLite/Module/MyCompany/OPC/Core/Collection/Shipping/ShippingDate.php', 'diagnostics': [{'source': 'intelephense', 'code': 1003, 'range': {'start': {'character': 4, 'line': 26}, 'end': {'character': 18, 'line': 26}}, 'severity': 4, 'message': "Symbol '$from' is declared but not used."}, {'source': 'intelephense', 'code': 1003, 'range': {'start': {'character': 4, 'line': 31}, 'end': {'character': 16, 'line': 31}}, 'severity': 4, 'message': "Symbol '$to' is declared but not used."}, {'source': 'intelephense', 'code': 1009, 'range': {'start': {'character': 32, 'line': 46}, 'end': {'character': 42, 'line': 46}}, 'severity': 1, 'message': "Undefined type 'DatePeriod'."}, {'source': 'intelephense', 'code': 1009, 'range': {'start': {'character': 31, 'line': 69}, 'end': {'character': 48, 'line': 69}}, 'severity': 1, 'message': "Undefined type 'DateTimeInterface'."}]}
:: <-  intelephense-ls textDocument/publishDiagnostics: {'uri': 'file:///var/www/html/myproject/classes/XLite/Module/MyCompany/OPC/Core/Collection/Shipping/ShippingDate.php', 'diagnostics': [{'source': 'intelephense', 'code': 1003, 'range': {'start': {'character': 4, 'line': 26}, 'end': {'character': 18, 'line': 26}}, 'severity': 4, 'message': "Symbol '$from' is declared but not used."}, {'source': 'intelephense', 'code': 1003, 'range': {'start': {'character': 4, 'line': 31}, 'end': {'character': 16, 'line': 31}}, 'severity': 4, 'message': "Symbol '$to' is declared but not used."}]}
:: <?  lsp-intelephense indexingStarted: None
:: <?  intelephense-ls indexingStarted: None
:: <?  intelephense-ls indexingEnded: None
:: <?  lsp-intelephense indexingEnded: None
:: <-  intelephense-ls textDocument/publishDiagnostics: {'uri': 'file:///var/www/html/myproject/classes/XLite/Module/MyCompany/OPC/Core/Collection/Shipping/ShippingDate.php', 'diagnostics': [{'source': 'intelephense', 'code': 1003, 'range': {'start': {'character': 4, 'line': 26}, 'end': {'character': 18, 'line': 26}}, 'severity': 4, 'message': "Symbol '$from' is declared but not used."}, {'source': 'intelephense', 'code': 1003, 'range': {'start': {'character': 4, 'line': 31}, 'end': {'character': 16, 'line': 31}}, 'severity': 4, 'message': "Symbol '$to' is declared but not used."}]}
:: <-  lsp-intelephense textDocument/publishDiagnostics: {'uri': 'file:///var/www/html/myproject/classes/XLite/Module/MyCompany/OPC/Core/Collection/Shipping/ShippingDate.php', 'diagnostics': [{'source': 'intelephense', 'code': 1003, 'range': {'start': {'character': 4, 'line': 26}, 'end': {'character': 18, 'line': 26}}, 'severity': 4, 'message': "Symbol '$from' is declared but not used."}, {'source': 'intelephense', 'code': 1003, 'range': {'start': {'character': 4, 'line': 31}, 'end': {'character': 16, 'line': 31}}, 'severity': 4, 'message': "Symbol '$to' is declared but not used."}]}

@jfcherng
Copy link
Collaborator

jfcherng commented Apr 10, 2020

In my experiments, I think it only counts newly indexed files. If you clean the cache dir and re-open the project, it should show many files are indexed.

@JoyceBabu
Copy link
Author

Where can I see the debug log? I am getting the following error when trying @antonpresn's config

Language server lsp-intelephense has crashed, do you want to restart it?

@jfcherng
Copy link
Collaborator

Where can I see the debug log?

  • if you mean LSP's debug log,
    image

  • if you mean intelephense's debug log, idk since I didn't try it.

@antonpresn
Copy link

@jfcherng Thank You for fast response :)

изображение

What I've done I can't reproduce :) - many restarts, and also

rm -rf /tmp/intelephense
rm -rf ~/.config/sublime-text-3/Cache/LSP*

Also I've noticed two options when disabling lsp
изображение

And only lsp-intelephence gives one file indexing
изображение

And finally! After disabling some packages (because found some errors in console) and lsp-intelephence (while intelephence-ls is still enabled) I can see my project indexed! And this is way better than before!

There are disabled ones
изображение

@JoyceBabu by the way my global config for LSP
изображение

@jfcherng
Copy link
Collaborator

I would suggest remove intelephense-ls which is an old solution and may cause confusion since you have both intelephense-ls and lsp-intelephense enabled (using both at the same time makes no sense imo).

@JoyceBabu
Copy link
Author

JoyceBabu commented Apr 10, 2020

Thank you @antonpresn @jfcherng .

You can find the difference between lsp-intelephense and intelephense-ls on the following page

sublimelsp/LSP#864

@JoyceBabu
Copy link
Author

Finally 🍻

lsp-intelephense: Indexing ended. 56953 files indexed in 73s.

@antonpresn If your issue is also solved, shall I close this issue?

@antonpresn
Copy link

Finally beers

lsp-intelephense: Indexing ended. 56953 files indexed in 73s.

@antonpresn If your issue is also solved, shall I close this issue?

@JoyceBabu, Great! I think yes, Issue is solved :)

изображение

It worked after I've copied your config from here #26 ;)

@JoyceBabu
Copy link
Author

Great  😀. I am closing the issue.

@HiteshZala13
Copy link

LPS. sublime setting

"show_diagnostics_panel_on_save": 0,

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

4 participants