mcpbeat

Patch Copied Lsp Sources

flutter/patch-copied-lsp-sources

Copy JetBrains LSP sources into the Dart plugin and patch them to prevent conflicts and ensure proper configuration.

4k tokens
context cost
the whole folder, loaded on every use
2
files
ships runnable scripts
0
copies elsewhere
how many repositories repackaged it
24
stars on the repo
on the repository, not the skill itself

Install

one command, takes just this skill from the repository
npx skills add https://github.com/flutter/dart-intellij-third-party --skill patch-copied-lsp-sources

What comes with it

12 581 bytes besides the instruction
scripts/patch.py

The instruction itself

3 sections, as written by the author

Patch Copied LSP Sources

Use this skill whenever JetBrains LSP source files are copied or refreshed from the intellij-community repository into the dart-intellij-third-party plugin. The skill automates the file copying, packaging them under the isolated com.intellij.platform.dartlsp package namespace directly, and applies all necessary adjustments to prevent conflicts with the built-in LSP client of IntelliJ IDEA.

How to Refresh and Apply

To copy the sources from intellij-community and apply the adjustments automatically:

  • Run the Python patch script located in the scripts directory from the repository root, passing the path to the local intellij-community repository as a positional argument:
   python3 .agents/skills/patch-copied-lsp-sources/scripts/patch.py /path/to/intellij-community
  • Verify the changes using git diff.
  • Verify that the project compiles:
   ./gradlew clean compileKotlin --no-build-cache

> [!NOTE]

> If you only need to re-apply the patches to the existing files in the workspace (without copying fresh files from intellij-community), you can run the script without any arguments:

> `bash

> python3 .agents/skills/patch-copied-lsp-sources/scripts/patch.py

> `

Record of Adjustments Applied

Here is the details of the changes made by the patch script:

  • Direct Package Copy & Rename:
  • Copies files directly from platform/lsp/src/com/intellij/platform/lsp into third_party/thirdPartySrc/platform-lsp/src/com/intellij/platform/dartlsp.
  • Rename package namespace references from com.intellij.platform.lsp to com.intellij.platform.dartlsp across all .kt, .java, and .xml source files to avoid split-package classloader collisions and wrong-namespace imports.
  • Registry Key & Timeout Key:
  • Rename key lsp.server.connect.timeout to dart.lsp.server.connect.timeout in dart-lsp-impl.xml and Lsp4jServerConnector.kt to avoid conflicting with IntelliJ IDEA's default LSP settings.
  • Notification Groups:
  • Prefix notification group IDs with Dart: in dart-lsp-impl.xml and LspServerNotificationsHandlerImpl.kt to avoid conflicts with IntelliJ's platform groups.
  • LSP window/showMessage -> Dart: LSP window/showMessage
  • LSP window/logMessage: errors, warnings -> Dart: LSP window/logMessage: errors, warnings
  • LSP window/logMessage: info, log; $/logTrace -> Dart: LSP window/logMessage: info, log; $/logTrace
  • Extension Element IDs:
  • Remove optional id="..." attributes from all extension definitions in dart-lsp-impl.xml (except <notificationGroup>), as they are optional and avoid ID collision warnings/conflicts.
  • Resource Bundle:
  • Change bundle reference from messages.LspBundle to messages.DartLspBundle in dart-lsp-impl.xml and LspBundle.kt.
  • Provide local DartLspBundle.properties resource file under third_party/src/main/resources/messages/ containing the required localization keys.
  • Log Registry Defaults:
  • Set defaultValue="false" for registry key lsp.communication.standard.log.file in dart-lsp-impl.xml to avoid spamming the main idea.log with LSP logs by default, storing them in session-specific files instead.
  • Intention Directory Names:
  • Rename the intention descriptions folder LspIntention to DartLspIntention and update descriptionDirectoryName to DartLspIntention in dart-lsp-impl.xml to prevent collision.
  • Support External Library Files:
  • Remove if (!ProjectFileIndex.getInstance(project).isInContent(file)) return false from LspServerImpl.isSupportedFile(file) so that the Dart LSP bridge can serve external library files (such as pub-cache packages and Dart SDK libraries like dart:io).

How to use it

Copy the folder

Take flutter/patch-copied-lsp-sources from the repository into ~/.claude/skills for personal use, or into .claude/skills inside a project.

Check the name does not clash

The agent identifies a skill by the name field in its header. Two skills with the same name cannot sit side by side — one of them will be ignored.