How polserver/vscode-escript works
Main Components
a) Client-side Components (VSCode Extension):
• Sub-components:
• Extension Activation Handler
• Debug Client
• Language Client
• Configuration Manager
b) Server-side Components:
• Sub-components:
• LSP Connection Handler
• Workspace Manager
• Documentation Downloader
• Analysis Engine
c) Native Components:
• Sub-components:
• EScript Compiler
• Completion Builder
• Definition Builder
• References Builder
• Hover Builder
• Signature Help Builder
• XML Doc Parser
d) External Components:
• POL Server (for debugging)
• Workspace Files
• Configuration Files (pol.cfg, ecompile.cfg)
Connection and Data Flow
• VSCode Extension → Language Server (LSP communication)
• Language Server → Native Module (compilation and analysis)
• VSCode Extension → POL Server (debugging via DAP)
• Language Server → Workspace Files (file system access)
Important Architectural Patterns to Highlight
a) Client-Server Architecture:
• Clear separation between extension client and language server
• LSP protocol communication
b) Native Bridge Pattern:
• How the TypeScript/JavaScript code interfaces with the C++ native module
c) Multi-process Architecture:
• Separation between:
• VSCode extension process
• Language server process
• POL server process (for debugging)
Additional Elements
• Supported file types (.src, .cfg)
• Key configuration options
• Memory management considerations
• Error handling flow
Bottom: Core Layer (Native Module)
Keep the abstraction level high enough to show the overall architecture while including enough detail to understand the key components and their interactions. Focus on showing how the language features (completion, hover, references) and debugging capabilities are implemented through the different layers of the system.
Remember to emphasize the extension's key features:
• Code completion
• Error detection
• Navigation features (go to definition, references)
• Debugging capabilities
• Formatting support