or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

docs

code-actions.mdcompletion.mdconfiguration.mddiagnostics.mdextensions.mdfloat-windows.mdindex.mdlists.mdnavigation.mdservice-management.md
tile.json

completion.mddocs/

Completion and IntelliSense

Intelligent code completion with LSP integration, snippet support, and customizable completion behavior. Provides VSCode-like completion experience with automatic triggering, context-aware suggestions, and seamless integration with language servers.

Capabilities

Manual Completion Control

Start, refresh, and control completion manually for custom workflows and advanced integration scenarios.

coc#start([{option}])
    " Start completion manually with optional configuration
    " Parameters:
    "   {option} - dict: completion options (optional)
    "     - refresh: boolean - force refresh sources
    "     - source: string - trigger specific source only
    " Returns: empty string

coc#refresh()
    " Refresh completion at current cursor position
    " Triggers completion sources without user input
    " Returns: empty string

coc#_insert_key({method}, {key} [, {hide_pum}])
    " Insert key with completion integration
    " Internal function for advanced key mapping

coc#on_enter()
    " Handle Enter key completion integration
    " Called automatically on Enter key press
    " Returns: empty string

Usage Examples:

" Manual completion trigger
inoremap <silent><expr> <c-space> coc#refresh()

" Custom completion with specific source
call coc#start({'source': 'word'})

" Force refresh all completion sources
call coc#refresh()

Popup Menu Control

Control the completion popup menu behavior, navigation, and selection for custom completion workflows.

coc#pum#visible()
    " Check if popup menu is currently visible
    " Returns: boolean

coc#pum#next({insert})
    " Move to next completion item
    " Parameters:
    "   {insert} - boolean: whether to insert on selection
    " Returns: empty string

coc#pum#prev({insert})  
    " Move to previous completion item
    " Parameters:
    "   {insert} - boolean: whether to insert on selection
    " Returns: empty string

coc#pum#cancel()
    " Cancel popup menu and return to original text
    " Returns: empty string

coc#pum#confirm()
    " Confirm current selection and insert text
    " Returns: empty string

coc#pum#scroll({forward})
    " Scroll popup menu content
    " Parameters:
    "   {forward} - boolean: true for down, false for up
    " Returns: empty string

Usage Examples:

" Smart tab completion
inoremap <silent><expr> <TAB>
    \ coc#pum#visible() ? coc#pum#next(1) :
    \ CheckBackspace() ? "\<Tab>" :
    \ coc#refresh()

inoremap <expr><S-TAB> coc#pum#visible() ? coc#pum#prev(1) : "\<C-h>"

" Confirm completion with Enter
inoremap <silent><expr> <CR> coc#pum#visible() ? coc#pum#confirm() : "\<CR>"

" Cancel completion with Escape  
inoremap <silent><expr> <Esc> coc#pum#visible() ? coc#pum#cancel() : "\<Esc>"

function! CheckBackspace() abort
    let col = col('.') - 1
    return !col || getline('.')[col - 1]  =~# '\s'
endfunction

Snippet Support

Advanced snippet expansion and navigation with tabstop support and dynamic snippet creation.

coc#expandable()
    " Check if snippet can be expanded at cursor
    " Returns: boolean

coc#jumpable()  
    " Check if cursor can jump to next snippet position
    " Returns: boolean

coc#expandableOrJumpable()
    " Check if snippet expandable or jumpable
    " Returns: boolean
    
coc#snippet#expand()
    " Expand snippet at cursor position
    " Returns: boolean - success status

coc#snippet#next()
    " Jump to next snippet tabstop
    " Returns: boolean - success status

coc#snippet#prev()
    " Jump to previous snippet tabstop  
    " Returns: boolean - success status

Usage Examples:

" Smart expand or jump with Tab
inoremap <silent><expr> <TAB>
    \ coc#pum#visible() ? coc#pum#next(1) :
    \ coc#expandableOrJumpable() ? "\<C-r>=coc#rpc#request('doKeymap', ['\<Tab>'])\<CR>" :
    \ CheckBackspace() ? "\<TAB>" :
    \ coc#refresh()

" Use <C-j> for jump to next placeholder
let g:coc_snippet_next = '<c-j>'

" Use <C-k> for jump to previous placeholder  
let g:coc_snippet_prev = '<c-k>'

" Check expandable status
if coc#expandable()
    call coc#snippet#expand()
endif

Completion Sources

Configure and manage completion sources for different contexts and languages.

" Built-in completion sources:
" - around: buffer words around cursor
" - buffer: current buffer words
" - file: file paths
" - word: words from all buffers
" - dictionary: dictionary words
" - tag: ctags

" Extension-provided sources:
" - Language servers (via extensions)
" - Custom sources (via extensions)
" - Snippets (coc-snippets)
" - Emoji (coc-emoji)

Usage Examples:

" Configure completion sources in coc-settings.json
{
  "suggest.enablePreview": true,
  "suggest.noselect": false,
  "suggest.enablePreselect": true,
  "suggest.maxCompleteItemCount": 20,
  "suggest.timeout": 500,
  "suggest.minTriggerInputLength": 1,
  "suggest.acceptSuggestionOnCommitCharacter": true,
  "suggest.snippetIndicator": "►"
}

Completion Behavior Configuration

Extensive configuration options for customizing completion behavior, appearance, and performance.

" Key configuration options (set in coc-settings.json):

" Trigger behavior
"suggest.autoTrigger": "always" | "none" | "trigger"
"suggest.triggerAfterInsertEnter": boolean
"suggest.timeout": number

" Selection behavior  
"suggest.noselect": boolean
"suggest.enablePreselect": boolean
"suggest.selection": "recentlyUsed" | "none" | "recentlyUsedByPrefix"

" Display options
"suggest.enablePreview": boolean
"suggest.maxCompleteItemCount": number
"suggest.snippetIndicator": string
"suggest.detailMaxLength": number
"suggest.detailField": "preview" | "menu" | "abbr"

" Performance options
"suggest.minTriggerInputLength": number
"suggest.filterGraceful": boolean
"suggest.localityBonus": boolean

Usage Examples:

" Disable automatic completion
{
  "suggest.autoTrigger": "none"
}

" Configure completion appearance
{
  "suggest.enablePreview": true,
  "suggest.maxCompleteItemCount": 50,
  "suggest.snippetIndicator": "🔸",
  "suggest.detailField": "preview"
}

" Performance tuning for large files
{
  "suggest.timeout": 1000,
  "suggest.minTriggerInputLength": 2,
  "suggest.localityBonus": true
}

Completion Context and Events

Handle completion events and customize behavior based on context and file types.

" Completion events (autocmds):
" - CompleteDone: after completion item selected
" - User CocStatusChange: when completion status changes
" - User CocOpenFloat: when completion detail opens

" Context functions:
coc#util#get_complete_option()       " Get current completion options
coc#util#change_info()               " Get buffer change information

Usage Examples:

" Custom completion post-processing
augroup coc_completion
  autocmd!
  autocmd CompleteDone * call OnCompleteDone()
augroup end

function! OnCompleteDone()
  if pumvisible() == 0
    " Completion finished, do custom processing
    echo "Completion done: " . v:completed_item.word
  endif
endfunction

" Disable completion for specific filetypes
autocmd FileType markdown let b:coc_suggest_disable = 1