Documentation
¶
Overview ¶
Package ipc provides IPC communication between JS and Go using stdio
Index ¶
Constants ¶
const Version = "1.0.0"
Version is the IPC protocol version
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ApplyFixesRequest ¶ added in v0.1.12
type ApplyFixesRequest struct { FileContent string `json:"fileContent"` // Current content of the file Diagnostics []Diagnostic `json:"diagnostics"` // Diagnostics with fixes to apply }
ApplyFixesRequest represents a request to apply fixes from JS to Go
type ApplyFixesResponse ¶ added in v0.1.12
type ApplyFixesResponse struct { FixedContent []string `json:"fixedContent"` // The content after applying fixes (array of intermediate versions) WasFixed bool `json:"wasFixed"` // Whether any fixes were actually applied AppliedCount int `json:"appliedCount"` // Number of fixes that were applied UnappliedCount int `json:"unappliedCount"` // Number of fixes that couldn't be applied }
ApplyFixesResponse represents a response after applying fixes
type Diagnostic ¶
type Diagnostic struct { RuleName string `json:"ruleName"` Message string `json:"message"` FilePath string `json:"filePath"` Range Range `json:"range"` Severity string `json:"severity,omitempty"` MessageId string `json:"messageId"` Fixes []Fix `json:"fixes,omitempty"` }
Diagnostic represents a single lint diagnostic
type ErrorResponse ¶
type ErrorResponse struct {
Message string `json:"message"`
}
ErrorResponse represents an error response
type Fix ¶ added in v0.1.12
type Fix struct { Text string `json:"text"` StartPos int `json:"startPos"` // Character position in the file content EndPos int `json:"endPos"` // Character position in the file content }
Fix represents a single fix that can be applied
type Handler ¶
type Handler interface { HandleLint(req LintRequest) (*LintResponse, error) HandleApplyFixes(req ApplyFixesRequest) (*ApplyFixesResponse, error) }
Handler defines the interface for handling IPC messages
type HandshakeRequest ¶
type HandshakeRequest struct {
Version string `json:"version"`
}
HandshakeRequest represents a handshake request
type HandshakeResponse ¶
HandshakeResponse represents a handshake response
type LintRequest ¶
type LintRequest struct { Files []string `json:"files,omitempty"` Config string `json:"config,omitempty"` // Path to rslint.json config file Format string `json:"format,omitempty"` WorkingDirectory string `json:"workingDirectory,omitempty"` // Supports both string level and array [level, options] format RuleOptions map[string]interface{} `json:"ruleOptions,omitempty"` FileContents map[string]string `json:"fileContents,omitempty"` // Map of file paths to their contents for VFS }
LintRequest represents a lint request from JS to Go
type LintResponse ¶
type LintResponse struct { Diagnostics []Diagnostic `json:"diagnostics"` ErrorCount int `json:"errorCount"` FileCount int `json:"fileCount"` RuleCount int `json:"ruleCount"` }
LintResponse represents a lint response from Go to JS
type Message ¶
type Message struct { Kind MessageKind `json:"kind"` ID int `json:"id"` Data interface{} `json:"data,omitempty"` }
Message represents an IPC message
type MessageKind ¶
type MessageKind string
MessageKind represents the kind of IPC message
const ( // KindLint is sent from JS to Go to request linting KindLint MessageKind = "lint" // KindApplyFixes is sent from JS to Go to request applying fixes KindApplyFixes MessageKind = "applyFixes" // KindResponse is sent from Go to JS with the lint results KindResponse MessageKind = "response" // KindError is sent when an error occurs KindError MessageKind = "error" // KindHandshake is sent for initial connection verification KindHandshake MessageKind = "handshake" // KindExit is sent to request termination KindExit MessageKind = "exit" )
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service manages the IPC communication
func NewService ¶
NewService creates a new IPC service