Skip to content

Conversation

@charlypa
Copy link
Contributor

@charlypa charlypa commented Nov 7, 2025

This commit enables the complete LSP infrastructure that was previously disabled in Phoenix. The LSP system provides a foundation for language server integration supporting features like code completion, parameter hints, jump to definition, find references, and diagnostics.

Changes:

  • Enabled LSP initialization in ClientLoader.js by uncommenting initDomainAndHandleNodeCrash() call
  • Enabled LSP unit tests in UnitTestSuite.js

The LSP infrastructure includes:

  • Complete Language Client implementation with Node.js bridge
  • Protocol adapter for LSP communication (JSON-RPC over IPC/stdio)
  • Default providers for code hints, parameter hints, and navigation
  • Support for all standard LSP features defined in ToolingInfo.json
  • Test suite with mock language servers

This enables the platform for JavaScript/TypeScript and other language server integrations. Language-specific clients can now be registered using LanguageTools.initiateToolingService() API.

What kind of change does this PR introduce?

  • Bugfix - fixes issues- give issue github url/details here.
  • Feature
  • Docs
  • Code style update
  • Refactor
  • Build-related changes
  • Other, please describe:

Screenshots or Gifs of the change

  1. Any visual or workflow changes must come with a gif or screenshot.
  2. Gif screen recordings help more if present. You can use one of the below free screen recorders:
    1. windows gif recorder- https://www.screentogif.com/
    2. mac gif recorder- https://apps.apple.com/au/app/giphy-capture-the-gif-maker/id668208984?mt=12
    3. linux gif recorder- https://github.com/phw/peek

Does this PR introduce a breaking change?

  • Yes, and the changes were approved in issue #___
  • No

Tests done

  • Describe unit tests done
  • Describe integration tests done
  • Describe manual tests done

Checklist

  • When resolving issues, reference those issue URLs in description.
  • Propose a changelog if this pull request has any customer facing impact.
  • I have added a convincing reason for adding this feature, if necessary.

Other information

pull request guidelines:

  • It's OK to have multiple small commits as you work on the PR - we will let GitHub automatically squash it before merging.
  • If adding new feature:, Provide convincing reason to add this feature. Ideally you should open a suggestion issue first and have it greenlighted before working on it.
  • If fixing a bug:Provide detailed description of the bug in the PR, or link to an issue that does.
  • Provide screenshots or gifs of the changes whenever possible.

This commit enables the complete LSP infrastructure that was previously
disabled in Phoenix. The LSP system provides a foundation for language
server integration supporting features like code completion, parameter
hints, jump to definition, find references, and diagnostics.

Changes:
- Enabled LSP initialization in ClientLoader.js by uncommenting
  initDomainAndHandleNodeCrash() call
- Enabled LSP unit tests in UnitTestSuite.js

The LSP infrastructure includes:
- Complete Language Client implementation with Node.js bridge
- Protocol adapter for LSP communication (JSON-RPC over IPC/stdio)
- Default providers for code hints, parameter hints, and navigation
- Support for all standard LSP features defined in ToolingInfo.json
- Test suite with mock language servers

This enables the platform for JavaScript/TypeScript and other language
server integrations. Language-specific clients can now be registered
using LanguageTools.initiateToolingService() API.
…LSP support

This commit adds full Language Server Protocol (LSP) support for JavaScript,
TypeScript, JSX, and TSX files using the TypeScript language server.

Changes:
- Created TypeScriptLanguageServer extension in src/extensions/default/
- Installed typescript-language-server v5.1.1 and typescript dependencies
- Registered extension in DefaultExtensions.json
- Configured language server to use stdio communication

Extension Components:
1. client.js (Node.js side)
   - Spawns typescript-language-server process
   - Configures server with --stdio communication
   - Sets up TypeScript preferences and initialization options

2. main.js (Phoenix/Brackets side)
   - Registers LSP client for ['javascript', 'typescript', 'jsx', 'tsx']
   - Integrates with LanguageTools.initiateToolingService API
   - Provides preference to enable/disable: languageTools.enableTypeScriptLSP

Features Enabled:
- Intelligent code completion with IntelliSense
- Parameter hints and signature help
- Jump to definition/declaration/implementation
- Find all references
- Document symbols (outline)
- Workspace symbols (project-wide search)
- Real-time error detection and diagnostics
- Rename refactoring
- Auto-imports

The TypeScript language server provides advanced TypeScript and JavaScript
code intelligence, significantly enhancing the development experience for
web developers using Phoenix.
Add test file with comprehensive examples to verify TypeScript language
server integration. File includes tests for:
- Code completion
- Hover information
- Error detection
- Function parameter hints
- Jump to definition
- Type inference
- JSDoc support

This file can be opened in Phoenix to manually verify all LSP features
are working correctly.
The path to typescript-language-server was incorrect (3 levels up instead of 4).

Fixed path: src/extensions/default/TypeScriptLanguageServer/ → project root
- Was: ../../../node_modules/ (goes to src/node_modules - wrong!)
- Now: ../../../../node_modules/ (goes to project root - correct!)

Also added architecture documentation to clarify:
- Phoenix runs in browser
- client.js runs in Node.js via NodeDomain
- Language server runs as child process of client.js
- LSP protocol bridges browser ↔ Node.js ↔ language server

This was a critical bug that would prevent the language server from
starting because it couldn't find the typescript-language-server binary.
Add diagnostic script to verify TypeScript LSP integration is ready to test.

The script checks:
- LSP infrastructure is enabled
- Extension is registered
- Extension files exist
- typescript-language-server is installed and executable
- Path resolution is correct
- All components can be found

Usage: node check-lsp-ready.js

This helps quickly verify everything is set up correctly before
attempting to test in the browser.
- Mark extension as nodeIsRequired: true (desktop app only)
- Required because LSP integration uses NodeDomain
- Follows Phoenix extension metadata conventions
@sonarqubecloud
Copy link

sonarqubecloud bot commented Nov 7, 2025

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

Successfully merging this pull request may close these issues.

2 participants