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
PHP Formatting Not Working #10902
Comments
@xcrap Does formatting manually with Or is formatting broken for both |
Both fails, also editor:format fails and with the same errors in the log. |
Also I closed all projects and try to edit a php from a clean folder for testing, why the hell he's downloading tailwindcss-language-server when there's no tailwind project o.O |
Additional log errors... 2024-04-24T12:03:58+00:00 [WARN] Generic lsp request to node failed: Unhandled method textDocument/definition |
This PR fixes the way we select the primary language server for use with formatting. Previously we were just taking the first one in the list, but this could be the wrong one in cases where a language server was provided by an extension in conjunction with a built-in language server (e.g., Tailwind). We now use the `primary_language_server_for_buffer` method to more accurately identify the primary one. Fixes #10902. Release Notes: - Fixed an issue where the wrong language server could be used for formatting.
So I've installed the nightly build and the formatter worked for PHP, but I had to specific in my settings: "PHP": { I wonder what's the default and if the default language_server for php, I mean that should work without specify or ? |
Hmm, you shouldn't have to specify the language server. The default is The bug that was fixed in #10939 was that the order of those language servers changed after PHP was moved to an extension, which meant that the Tailwind language server would receive the formatting request. If you remove that |
If I remove the language_servers I get this: 2024-04-25T18:17:03+00:00 [ERROR] Have not found plugin path for "@prettier/plugin-php" inside "/Users/xcrap/node_modules" So the order is clearly not the best. Also If I remove ""formatter": "language_server", (I believe it uses auto) it's even worse it tries to use prettier. My point is that the PHP formatter should work out of the box without any specific option, which it did before the extensions, now it does not at least for me. |
I can see here that Intelephense is indeed being loaded last.
Although I forgot that the fix made in #10939 doesn't rely on the order listed there. However, it does look like you have Emmet installed, which is being put before Intelephense. Could you try uninstalling the Emmet extension to see if that fixes the issue? If that does indeed fix the issue, then continuing to use this setting would be my recommendation to work around the problem, for now: "languages": {
"PHP": {
"language_servers": ["intelephense", "..."]
}
} |
Yes I can confirm that uninstalling emmet did solved the issue. I'll have emmet uninstalled until you guys figure this out. Thanks for the quick answers. |
Check for existing issues
Describe the bug / provide steps to reproduce it
I've asked for help in other PHP related issues and code formatting issues I'm creating this specific because the language_server works with most files but it's not working with PHP since ZED moved PHP to an extension. But only the format on save is not working.... I had to move back to VSCODE because it stopped working and I have no idea why. Anybody?
Opening Zed, saving a PHP file... I get this in my LOG
2024-04-23T18:15:50+00:00 [INFO] ========== starting zed ==========
2024-04-23T18:15:50+00:00 [INFO] Opening main db
2024-04-23T18:15:50+00:00 [INFO] Using git binary path: Some("/Applications/Zed.app/Contents/MacOS/git")
2024-04-23T18:15:50+00:00 [INFO] extensions updated. loading 3, reloading 0, unloading 0
2024-04-23T18:15:50+00:00 [ERROR] crates/zed/src/zed.rs:628: EOF while parsing a value at line 1 column 0
2024-04-23T18:15:50+00:00 [INFO] Opening main db
2024-04-23T18:15:51+00:00 [INFO] set status on client 0: Authenticating
2024-04-23T18:15:51+00:00 [INFO] set status on client 98447: Connecting
2024-04-23T18:15:51+00:00 [INFO] building git repository,
.git
path in the worktree: ".git"2024-04-23T18:15:51+00:00 [INFO] Opening main db
2024-04-23T18:15:51+00:00 [INFO] Opening main db
2024-04-23T18:15:51+00:00 [INFO] set environment variables from shell:/bin/zsh, path:/Users/xcrap/.bun/bin:/opt/homebrew/opt/curl/bin:/opt/homebrew/opt/curl/bin:/opt/homebrew/opt/curl/bin:/Users/xcrap/Library/Application Support/Herd/bin/:/Users/xcrap/miniconda3/bin:/Users/xcrap/miniconda3/condabin:/opt/homebrew/bin:/opt/homebrew/sbin:/Users/xcrap/.nvm/versions/node/v20.10.0/bin:/Applications/MAMP/bin/php/php8.2.4/bin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin://Applications/Topaz Photo AI.app/Contents/Resources/bin:/Users/xcrap/Library/Application Support/JetBrains/Toolbox/scripts
2024-04-23T18:15:51+00:00 [INFO] starting language server "tailwindcss-language-server", path: "/Users/xcrap/htdocs/hotelgaivota", id: 1
2024-04-23T18:15:51+00:00 [INFO] starting language server "intelephense", path: "/Users/xcrap/htdocs/hotelgaivota", id: 2
2024-04-23T18:15:51+00:00 [INFO] fetching latest version of language server "tailwindcss-language-server"
2024-04-23T18:15:51+00:00 [INFO] Node runtime install_if_needed
2024-04-23T18:15:51+00:00 [INFO] Node runtime install_if_needed
2024-04-23T18:15:51+00:00 [INFO] connected to rpc endpoint https://collab.zed.dev/rpc
2024-04-23T18:15:51+00:00 [INFO] Node runtime install_if_needed
2024-04-23T18:15:52+00:00 [INFO] starting language server. binary path: "/Users/xcrap/Library/Application Support/Zed/node/node-v18.15.0-darwin-arm64/bin/node", working directory: "/", args: ["/Users/xcrap/Library/Application Support/Zed/copilot/copilot-v0.5.0/dist/agent.js", "--stdio"]
2024-04-23T18:15:52+00:00 [INFO] add connection to peer
2024-04-23T18:15:52+00:00 [INFO] waiting for server hello
2024-04-23T18:15:52+00:00 [INFO] got server hello
2024-04-23T18:15:52+00:00 [INFO] set status to connected (connection id: ConnectionId { owner_id: 0, id: 0 }, peer id: PeerId { owner_id: 392, id: 4189661 })
2024-04-23T18:15:52+00:00 [INFO] set status on client 98447: Connected { peer_id: PeerId { owner_id: 392, id: 4189661 }, connection_id: ConnectionId { owner_id: 0, id: 0 } }
2024-04-23T18:15:52+00:00 [INFO] Language server with id 0 sent unhandled notification LogMessage:
{
"level": 0,
"message": "[DEBUG] [agent] [2024-04-23T18:15:52.337Z] Agent service starting",
"metadataStr": "[DEBUG] [agent] [2024-04-23T18:15:52.337Z]",
"extra": [
"Agent service starting"
]
}
2024-04-23T18:15:52+00:00 [INFO] Language server with id 0 sent unhandled notification client/registerCapability:
{
"registrations": [
{
"id": "e963ed01-14bc-4e67-8e49-e8e9395530d4",
"method": "workspace/didChangeWorkspaceFolders",
"registerOptions": {}
}
]
}
2024-04-23T18:15:52+00:00 [INFO] Language server with id 0 sent unhandled notification LogMessage:
{
"level": 0,
"message": "[DEBUG] [agent] [2024-04-23T18:15:52.867Z] Telemetry initialized",
"metadataStr": "[DEBUG] [agent] [2024-04-23T18:15:52.867Z]",
"extra": [
"Telemetry initialized"
]
}
2024-04-23T18:15:52+00:00 [INFO] Node runtime install_if_needed
2024-04-23T18:15:53+00:00 [INFO] starting language server. binary path: "/Users/xcrap/Library/Application Support/Zed/node/node-v18.15.0-darwin-arm64/bin/node", working directory: "/Users/xcrap/htdocs/hotelgaivota", args: ["/Users/xcrap/Library/Application Support/Zed/extensions/work/php/node_modules/intelephense/lib/intelephense.js", "--stdio"]
2024-04-23T18:15:53+00:00 [INFO] Language server with id 2 sent unhandled notification window/logMessage:
{
"type": 3,
"message": "Initialising intelephense 1.10.4"
}
2024-04-23T18:15:53+00:00 [INFO] Language server with id 2 sent unhandled notification window/logMessage:
{
"type": 3,
"message": "Reading state from /var/folders/0j/629mw8tj5y7dkm056_1pthq40000gn/T/intelephense/44936fb5."
}
2024-04-23T18:15:53+00:00 [INFO] Language server with id 2 sent unhandled notification window/logMessage:
{
"type": 3,
"message": "Initialised in 78 ms"
}
2024-04-23T18:15:53+00:00 [INFO] downloading language server "tailwindcss-language-server"
2024-04-23T18:15:53+00:00 [INFO] Node runtime install_if_needed
2024-04-23T18:15:53+00:00 [INFO] Language server with id 2 sent unhandled notification indexingStarted:
[
null
]
2024-04-23T18:15:53+00:00 [INFO] starting language server. binary path: "/Users/xcrap/Library/Application Support/Zed/node/node-v18.15.0-darwin-arm64/bin/node", working directory: "/Users/xcrap/htdocs/hotelgaivota", args: ["/Users/xcrap/Library/Application Support/Zed/languages/tailwindcss-language-server/node_modules/.bin/tailwindcss-language-server", "--stdio"]
2024-04-23T18:15:53+00:00 [INFO] Language server with id 2 sent unhandled notification indexingEnded:
[
null
]
2024-04-23T18:15:54+00:00 [INFO] Language server with id 1 sent unhandled notification @/tailwindCSS/projectInitialized:
[
null
]
Environment
Zed: v0.131.7 (Zed)
OS: macOS 14.4.1
Memory: 16 GiB
Architecture: aarch64
If applicable, add mockups / screenshots to help explain present your vision of the feature
No response
If applicable, attach your
~/Library/Logs/Zed/Zed.log
file to this issue.No response
The text was updated successfully, but these errors were encountered: