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

language server support in the browser. #27

Open
9 tasks
abose opened this issue Aug 16, 2021 · 4 comments
Open
9 tasks

language server support in the browser. #27

abose opened this issue Aug 16, 2021 · 4 comments
Assignees
Labels
core Core features enhancement New feature or request

Comments

@abose
Copy link
Member

abose commented Aug 16, 2021

Language server support is essential for the future of phcode.dev. Language servers brings in code auto completion and advanced code assistance features inside phoenix. Almost all implementations currently in existence require node and the few that work in the browser(ts language server) run only in vscode.dev.

We should find a way to browserify popular language servers in pure browser-based environments. This will help web-based code editors like us and others to provide advanced IDE-like features in the browser.

Language server in Browser and mobile devices

While this is fairly possible if we have a node engine(Eg. in native windows/mac/Linux) builds, We will hit a roadblock if we have to deploy a code editor in the browser or mobile devices like android or ios.

The best case is to be able to run language servers in the browser. As browser environments are readily available in mobile platforms as well as desktops/servers, this will help develop a universal language server component that can work in any device with a browser environment.

Feature requirements Phase 1

Phoenix should support the following language servers out of the box as a pure browser client:

  • Generic infrastructure to run language servers in browser and language server client for phcode.dev
  • Should work in mobile/desktop browsers and web views.
  • Language intelligence should be in the web worker when possible.
  • Account for Remote language server support for remote/cloud projects.
  • Typescript/Javascript language server integration based on our in-browser LSP infra. Javascript code intelligence in phoenix is best to be deprecated in favor of an LSP-based implementation.

Feature requirements Phase 2

  • Angular Language Service
  • React language server. This appears to come free with Typescript language server. Phoenix currently has limited support for react language intelligence with our own implementation using ternjs.
  • Extensibility API for third party language servers integration
  • vue/vite/other frameworks that are in demand by our users.

Related issues:

  1. Language Servers #587
  2. [Feature Request] Vue Language Support #682
  3. Feature request: Default type script suppot #166
  4. Php tooling extension removed #8
  5. Embedded languages in tagged templates #762
@abose abose mentioned this issue Aug 16, 2021
28 tasks
@charlypa
Copy link
Contributor

charlypa commented Aug 26, 2021

Pheonix does not uses the VScode language server protocol for code completion of js. Pheonix has its own internal implementation for code completion, which is written in Javascript. This has nothing to do with visual studio code.

Phoenix has a language client adapter implemented earlier with node, but this is only implemented for PHP currently.

Please refer to the below codes for reference
https://github.com/aicore/phoenix/blob/main/src/languageTools/LanguageClient/ServerUtils.js#L268-L322

https://github.com/aicore/phoenix/blob/main/src/languageTools/LanguageClient/ServerUtils.js#L324-L368

@abose abose reopened this Dec 24, 2022
@abose
Copy link
Member Author

abose commented Dec 24, 2022

This issue was earlier closed as Phoenix implemented its own language intelligence implementation for js/html based on tern-js.
Re-opened as the root LSP feature support is still missing and requires active development.

@abose abose changed the title Investigate language server migration in the browser. language server support in the browser. Dec 24, 2022
@abose abose added enhancement New feature or request core Core features labels Dec 24, 2022
@charlypa
Copy link
Contributor

LSP Configurations

vscode-html-language-server

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "capabilities": {
      "textDocumentSync": 2,
      "hoverProvider": true,
      "documentHighlightProvider": true,
      "documentRangeFormattingProvider": false,
      "documentFormattingProvider": false,
      "documentLinkProvider": {
        "resolveProvider": false
      },
      "documentSymbolProvider": true,
      "definitionProvider": true,
      "signatureHelpProvider": {
        "triggerCharacters": [
          "("
        ]
      },
      "referencesProvider": true,
      "colorProvider": {},
      "foldingRangeProvider": true,
      "selectionRangeProvider": true,
      "renameProvider": true,
      "linkedEditingRangeProvider": true,
      "diagnosticProvider": {
        "documentSelector": null,
        "interFileDependencies": false,
        "workspaceDiagnostics": false
      }
    }
  }
}

vscode-markdown-language-server

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "capabilities": {
      "diagnosticProvider": {
        "documentSelector": null,
        "identifier": "markdown",
        "interFileDependencies": true,
        "workspaceDiagnostics": false
      },
      "codeActionProvider": {
        "resolveProvider": true,
        "codeActionKinds": [
          "source.organizeLinkDefinitions",
          "quickfix",
          "refactor"
        ]
      },
      "definitionProvider": true,
      "documentLinkProvider": {
        "resolveProvider": true
      },
      "documentSymbolProvider": true,
      "foldingRangeProvider": true,
      "referencesProvider": true,
      "renameProvider": {
        "prepareProvider": true
      },
      "selectionRangeProvider": true,
      "workspaceSymbolProvider": true,
      "workspace": {
        "workspaceFolders": {
          "supported": true,
          "changeNotifications": true
        }
      },
      "textDocumentSync": 2
    }
  }
}

vscode-eslint-language-server

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "capabilities": {
      "textDocumentSync": {
        "openClose": true,
        "change": 2,
        "willSaveWaitUntil": false,
        "save": {
          "includeText": false
        }
      },
      "workspace": {
        "workspaceFolders": {
          "supported": true
        }
      },
      "executeCommandProvider": {
        "commands": [
          "eslint.applySingleFix",
          "eslint.applySuggestion",
          "eslint.applySameFixes",
          "eslint.applyAllFixes",
          "eslint.applyDisableLine",
          "eslint.applyDisableFile",
          "eslint.openRuleDoc"
        ]
      }
    }
  }
}

vscode-css-language-server

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "capabilities": {
      "textDocumentSync": 2,
      "hoverProvider": true,
      "documentSymbolProvider": true,
      "referencesProvider": true,
      "definitionProvider": true,
      "documentHighlightProvider": true,
      "documentLinkProvider": {
        "resolveProvider": false
      },
      "codeActionProvider": true,
      "renameProvider": true,
      "colorProvider": {},
      "foldingRangeProvider": true,
      "selectionRangeProvider": true,
      "diagnosticProvider": {
        "documentSelector": null,
        "interFileDependencies": false,
        "workspaceDiagnostics": false
      },
      "documentRangeFormattingProvider": false,
      "documentFormattingProvider": false
    }
  }
}

vscode-json-language-server

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "capabilities": {
      "textDocumentSync": 2,
      "hoverProvider": true,
      "documentSymbolProvider": true,
      "documentRangeFormattingProvider": false,
      "documentFormattingProvider": false,
      "colorProvider": {},
      "foldingRangeProvider": true,
      "selectionRangeProvider": true,
      "documentLinkProvider": {},
      "diagnosticProvider": {
        "documentSelector": null,
        "interFileDependencies": false,
        "workspaceDiagnostics": false
      },
      "codeActionProvider": true
    }
  }
}

@charlypa
Copy link
Contributor

To install lsp use following command

npm install -g vscode-langservers-extracted

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Core features enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants