lsutil

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2026 License: MIT, Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssertHasRealPosition

func AssertHasRealPosition(node *ast.Node)

func GetFirstToken

func GetFirstToken(node *ast.Node, sourceFile *ast.SourceFile) *ast.Node

func GetLastChild

func GetLastChild(node *ast.Node, sourceFile *ast.SourceFile) *ast.Node

Replaces last(node.getChildren(sourceFile))

func GetLastToken

func GetLastToken(node *ast.Node, sourceFile *ast.SourceFile) *ast.Node

func GetLastVisitedChild

func GetLastVisitedChild(node *ast.Node, sourceFile *ast.SourceFile) *ast.Node

Gets the last visited child of the given node. NOTE: This doesn't include unvisited tokens; for this, use `getLastChild` or `getLastToken`.

func NodeIsASICandidate

func NodeIsASICandidate(node *ast.Node, file *ast.SourceFile) bool

func PositionIsASICandidate

func PositionIsASICandidate(pos int, context *ast.Node, file *ast.SourceFile) bool

func SyntaxMayBeASICandidate

func SyntaxMayBeASICandidate(kind ast.Kind) bool

func SyntaxRequiresTrailingCommaOrSemicolonOrASI

func SyntaxRequiresTrailingCommaOrSemicolonOrASI(kind ast.Kind) bool

func SyntaxRequiresTrailingFunctionBlockOrSemicolonOrASI

func SyntaxRequiresTrailingFunctionBlockOrSemicolonOrASI(kind ast.Kind) bool

func SyntaxRequiresTrailingModuleBlockOrSemicolonOrASI

func SyntaxRequiresTrailingModuleBlockOrSemicolonOrASI(kind ast.Kind) bool

func SyntaxRequiresTrailingSemicolonOrASI

func SyntaxRequiresTrailingSemicolonOrASI(kind ast.Kind) bool

Types

type EditorSettings

type EditorSettings struct {
	BaseIndentSize         int
	IndentSize             int
	TabSize                int
	NewLineCharacter       string
	ConvertTabsToSpaces    bool
	IndentStyle            IndentStyle
	TrimTrailingWhitespace bool
}

type FormatCodeSettings

type FormatCodeSettings struct {
	EditorSettings
	InsertSpaceAfterCommaDelimiter                              core.Tristate
	InsertSpaceAfterSemicolonInForStatements                    core.Tristate
	InsertSpaceBeforeAndAfterBinaryOperators                    core.Tristate
	InsertSpaceAfterConstructor                                 core.Tristate
	InsertSpaceAfterKeywordsInControlFlowStatements             core.Tristate
	InsertSpaceAfterFunctionKeywordForAnonymousFunctions        core.Tristate
	InsertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis  core.Tristate
	InsertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets     core.Tristate
	InsertSpaceAfterOpeningAndBeforeClosingNonemptyBraces       core.Tristate
	InsertSpaceAfterOpeningAndBeforeClosingEmptyBraces          core.Tristate
	InsertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces core.Tristate
	InsertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces  core.Tristate
	InsertSpaceAfterTypeAssertion                               core.Tristate
	InsertSpaceBeforeFunctionParenthesis                        core.Tristate
	PlaceOpenBraceOnNewLineForFunctions                         core.Tristate
	PlaceOpenBraceOnNewLineForControlBlocks                     core.Tristate
	InsertSpaceBeforeTypeAnnotation                             core.Tristate
	IndentMultiLineObjectLiteralBeginningOnBlankLine            core.Tristate
	Semicolons                                                  SemicolonPreference
	IndentSwitchCase                                            core.Tristate
}

func GetDefaultFormatCodeSettings

func GetDefaultFormatCodeSettings() *FormatCodeSettings

func (*FormatCodeSettings) Copy

func (settings *FormatCodeSettings) Copy() *FormatCodeSettings

func (*FormatCodeSettings) Parse

func (settings *FormatCodeSettings) Parse(prefs any) bool

func (*FormatCodeSettings) ParseEditorSettings

func (settings *FormatCodeSettings) ParseEditorSettings(editorSettings map[string]any) *FormatCodeSettings

func (*FormatCodeSettings) Set

func (settings *FormatCodeSettings) Set(name string, value any) bool

type IndentStyle

type IndentStyle int
const (
	IndentStyleNone IndentStyle = iota
	IndentStyleBlock
	IndentStyleSmart
)

type SemicolonPreference

type SemicolonPreference string
const (
	SemicolonPreferenceIgnore SemicolonPreference = "ignore"
	SemicolonPreferenceInsert SemicolonPreference = "insert"
	SemicolonPreferenceRemove SemicolonPreference = "remove"
)

Jump to

Keyboard shortcuts

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