comment

package
v1.7.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 15, 2026 License: MIT Imports: 2 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package comment holds the comment tokens of the languages (SPEC §8.6.5): what the commands that comment and uncomment lines need to know of a language. It has no text and no cursors; the editing functions of internal/core/edit use it.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Language

type Language struct {
	// Line starts a comment that ends with the line; empty for none.
	Line string
	// NoIndent puts a line comment at the first column and not at the indentation of the line.
	NoIndent bool
	// BlockStart and BlockEnd begin and end a block comment; both are empty for none.
	BlockStart, BlockEnd string
}

Language is how the comments of one language are written. It is read-only once made, so it can be shared.

func NewLanguage

func NewLanguage(c *language.Configuration) *Language

NewLanguage makes the Language of a language configuration, which may be nil.

Ported from VS Code: src/vs/editor/common/languages/languageConfigurationRegistry.ts (_handleComments)

func (*Language) HasBlock

func (l *Language) HasBlock() bool

HasBlock reports whether the language has block comments.

type Languages

type Languages interface {
	Language(code int) *Language
}

Languages gives the Language for the code of a language of the document or of one embedded in it. It must never return nil.

type RegistryLanguages

type RegistryLanguages struct {
	// contains filtered or unexported fields
}

RegistryLanguages gives the Languages of a language registry. It makes each once.

func NewRegistryLanguages

func NewRegistryLanguages(reg *language.Registry) *RegistryLanguages

NewRegistryLanguages makes the Languages of a registry. When the configurations of the registry change, make a new one.

func (*RegistryLanguages) Language

func (r *RegistryLanguages) Language(code int) *Language

Language implements Languages.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL