Documentation ¶
Index ¶
- func NewCORSDisablerWrapper(parent http.Handler) http.Handler
- func SpaFileServer(root http.Dir) http.Handler
- func ValidateContentLength(r *http.Request) error
- func WrapHandler(h HandlerFunc, guards ...GuardFn) http.HandlerFunc
- func WriteJSON(w http.ResponseWriter, i interface{})
- type BuildResponse
- type ErrorResponse
- type GuardFn
- type HTTPError
- type HandlerFunc
- type RunResponse
- type Service
- func (s *Service) HandleArtifactRequest(w http.ResponseWriter, r *http.Request) error
- func (s *Service) HandleCompile(w http.ResponseWriter, r *http.Request) error
- func (s *Service) HandleFormatCode(w http.ResponseWriter, r *http.Request) error
- func (s *Service) HandleGetSnippet(w http.ResponseWriter, r *http.Request) error
- func (s *Service) HandleGetSuggestion(w http.ResponseWriter, r *http.Request) error
- func (s *Service) HandleGetVersion(w http.ResponseWriter, r *http.Request) error
- func (s *Service) HandleRunCode(w http.ResponseWriter, r *http.Request) error
- func (s *Service) HandleShare(w http.ResponseWriter, r *http.Request) error
- func (s *Service) Mount(r *mux.Router)
- type ShareResponse
- type SnippetResponse
- type SuggestionRequest
- type SuggestionsResponse
- type VersionResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewCORSDisablerWrapper ¶
NewCORSDisablerWrapper returns new CORS middleware
func SpaFileServer ¶ added in v1.1.0
SpaFileServer returns SPA handler
func ValidateContentLength ¶ added in v1.4.1
ValidateContentLength validates Go code snippet size
func WrapHandler ¶ added in v1.4.1
func WrapHandler(h HandlerFunc, guards ...GuardFn) http.HandlerFunc
WrapHandler wraps handler
func WriteJSON ¶
func WriteJSON(w http.ResponseWriter, i interface{})
WriteJSON encodes object as JSON and writes it to stdout
Types ¶
type BuildResponse ¶ added in v1.3.0
type BuildResponse struct { // Formatted contains goimport'ed code Formatted string `json:"formatted,omitempty"` // FileName is file name FileName string `json:"fileName,omitempty"` }
BuildResponse is code complile response
type ErrorResponse ¶
type ErrorResponse struct { // Error is error message Error string `json:"error"` // contains filtered or unexported fields }
ErrorResponse is error response
func NewErrorResponse ¶
func NewErrorResponse(err error) *ErrorResponse
NewErrorResponse is ErrorResponse constructor
func (*ErrorResponse) Write ¶
func (r *ErrorResponse) Write(w http.ResponseWriter) http.ResponseWriter
Write writes error to response
type HTTPError ¶ added in v1.4.1
type HTTPError struct {
// contains filtered or unexported fields
}
HTTPError is HTTP response error
func NewHTTPError ¶ added in v1.4.1
NewHTTPError constructs a new error
func (*HTTPError) WriteResponse ¶ added in v1.4.1
func (err *HTTPError) WriteResponse(rw http.ResponseWriter)
WriteResponse writes error to response
type HandlerFunc ¶ added in v1.4.1
type HandlerFunc func(http.ResponseWriter, *http.Request) error
HandlerFunc is langserver request handler
type RunResponse ¶ added in v1.3.0
type RunResponse struct { // Formatted contains goimport'ed code Formatted string `json:"formatted,omitempty"` // Events is list of code execution outputs Events []*goplay.CompileEvent `json:"events,omitempty"` }
RunResponse is code run response
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service is language server service
func New ¶
func New(version string, playground *goplay.Client, packages []*analyzer.Package, builder compiler.BuildService) *Service
New is Service constructor
func (*Service) HandleArtifactRequest ¶ added in v1.3.0
HandleArtifactRequest handles WASM build artifact request
func (*Service) HandleCompile ¶ added in v1.3.0
HandleCompile handles WASM build request
func (*Service) HandleFormatCode ¶ added in v1.3.0
HandleFormatCode handles goimports action
func (*Service) HandleGetSnippet ¶ added in v1.3.0
HandleGetSnippet handles snippet load
func (*Service) HandleGetSuggestion ¶ added in v1.3.0
HandleGetSuggestion handles code suggestion
func (*Service) HandleGetVersion ¶ added in v1.5.0
HandleGetVersion handles /api/version
func (*Service) HandleRunCode ¶ added in v1.3.0
HandleRunCode handles code run
func (*Service) HandleShare ¶ added in v1.3.0
HandleShare handles snippet share
type ShareResponse ¶ added in v1.1.0
type ShareResponse struct { string `json:"snippetID"` }SnippetID
ShareResponse is snippet share response
type SnippetResponse ¶ added in v1.1.0
type SnippetResponse struct { // FileName is snippet file name FileName string `json:"fileName"` // Code is snippet source Code string `json:"code"` }
SnippetResponse is snippet response
type SuggestionRequest ¶
type SuggestionRequest struct { PackageName string `json:"packageName"` Value string `json:"value"` }
SuggestionRequest is code completion suggestion request
func (SuggestionRequest) Trim ¶
func (sr SuggestionRequest) Trim() SuggestionRequest
Trim trims request payload
type SuggestionsResponse ¶
type SuggestionsResponse struct { // Suggestions is list of suggestions for monaco Suggestions []*analyzer.CompletionItem `json:"suggestions"` }
SuggestionsResponse is code completion response
func (SuggestionsResponse) Write ¶
func (r SuggestionsResponse) Write(w http.ResponseWriter)
Write writes data to response
type VersionResponse ¶ added in v1.5.0
type VersionResponse struct { // Version is server version Version string `json:"version"` }
VersionResponse is version response
func (VersionResponse) Write ¶ added in v1.5.0
func (r VersionResponse) Write(w http.ResponseWriter)
Write writes data to response