view runtime/syntax/dylan.vim @ 33399:95db67c7b754 v9.0.1958

patch 9.0.1958: cannot complete option values Commit: https://github.com/vim/vim/commit/900894b09a95398dfc75599e9f0aa2ea25723384 Author: Yee Cheng Chin <ychin.git@gmail.com> Date: Fri Sep 29 20:42:32 2023 +0200 patch 9.0.1958: cannot complete option values Problem: cannot complete option values Solution: Add completion functions for several options Add cmdline tab-completion for setting string options Add tab-completion for setting string options on the cmdline using `:set=` (along with `:set+=` and `:set-=`). The existing tab completion for setting options currently only works when nothing is typed yet, and it only fills in with the existing value, e.g. when the user does `:set diffopt=<Tab>` it will be completed to `set diffopt=internal,filler,closeoff` and nothing else. This isn't too useful as a user usually wants auto-complete to suggest all the possible values, such as 'iblank', or 'algorithm:patience'. For set= and set+=, this adds a new optional callback function for each option that can be invoked when doing completion. This allows for each option to have control over how completion works. For example, in 'diffopt', it will suggest the default enumeration, but if `algorithm:` is selected, it will further suggest different algorithm types like 'meyers' and 'patience'. When using set=, the existing option value will be filled in as the first choice to preserve the existing behavior. When using set+= this won't happen as it doesn't make sense. For flag list options (e.g. 'mouse' and 'guioptions'), completion will take into account existing typed values (and in the case of set+=, the existing option value) to make sure it doesn't suggest duplicates. For set-=, there is a new `ExpandSettingSubtract` function which will handle flag list and comma-separated options smartly, by only suggesting values that currently exist in the option. Note that Vim has some existing code that adds special handling for 'filetype', 'syntax', and misc dir options like 'backupdir'. This change preserves them as they already work, instead of converting to the new callback API for each option. closes: #13182 Signed-off-by: Christian Brabandt <cb@256bit.org> Co-authored-by: Yee Cheng Chin <ychin.git@gmail.com>
author Christian Brabandt <cb@256bit.org>
date Fri, 29 Sep 2023 20:45:04 +0200
parents 46763b01cd9a
children
line wrap: on
line source

" Vim syntax file
" Language:	Dylan
" Authors:	Justus Pendleton <justus@acm.org>
"		Brent A. Fulgham <bfulgham@debian.org>
" Last Change:	Fri Sep 29 13:45:55 PDT 2000
"
" This syntax file is based on the Haskell, Perl, Scheme, and C
" syntax files.

" Part 1:  Syntax definition
" quit when a syntax file was already loaded
if exists("b:current_syntax")
  finish
endif

syn case ignore

setlocal lisp

" Highlight special characters (those that have backslashes) differently
syn match	dylanSpecial		display contained "\\\(x\x\+\|\o\{1,3}\|.\|$\)"

" Keywords
syn keyword	dylanBlock		afterwards begin block cleanup end
syn keyword	dylanClassMods		abstract concrete primary inherited virtual
syn keyword	dylanException		exception handler signal
syn keyword	dylanParamDefs		method class function library macro interface
syn keyword	dylanSimpleDefs		constant variable generic primary
syn keyword	dylanOther		above below from by in instance local slot subclass then to
syn keyword	dylanConditional	if when select case else elseif unless finally otherwise then
syn keyword	dylanRepeat		begin for until while from to
syn keyword	dylanStatement		define let
syn keyword	dylanImport		use import export exclude rename create
syn keyword	dylanMiscMods		open sealed domain singleton sideways inline functional

" Matching rules for special forms
syn match	dylanOperator		"\s[-!%&\*\+/=\?@\\^|~:]\+[-#!>%&:\*\+/=\?@\\^|~]*"
syn match	dylanOperator		"\(\<[A-Z][a-zA-Z0-9_']*\.\)\=:[-!#$%&\*\+./=\?@\\^|~:]*"
" Numbers
syn match	dylanNumber		"\<[0-9]\+\>\|\<0[xX][0-9a-fA-F]\+\>\|\<0[oO][0-7]\+\>"
syn match	dylanNumber		"\<[0-9]\+\.[0-9]\+\([eE][-+]\=[0-9]\+\)\=\>"
" Booleans
syn match	dylanBoolean		"#t\|#f"
" Comments
syn match	dylanComment		"//.*"
syn region	dylanComment		start="/\*" end="\*/"
" Strings
syn region	dylanString		start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=dySpecial
syn match	dylanCharacter		"'[^\\]'"
" Constants, classes, and variables
syn match	dylanConstant		"$\<[a-zA-Z0-9\-]\+\>"
syn match	dylanClass		"<\<[a-zA-Z0-9\-]\+\>>"
syn match	dylanVariable		"\*\<[a-zA-Z0-9\-]\+\>\*"
" Preconditions
syn region	dylanPrecondit		start="^\s*#\s*\(if\>\|else\>\|endif\>\)" skip="\\$" end="$"

" These appear at the top of files (usually).  I like to highlight the whole line
" so that the definition stands out.  They should probably really be keywords, but they
" don't generally appear in the middle of a line of code.
syn region	dylanHeader	start="^[Mm]odule:" end="^$"

" Define the default highlighting.
" Only when an item doesn't have highlighting yet

hi def link dylanBlock		PreProc
hi def link dylanBoolean		Boolean
hi def link dylanCharacter		Character
hi def link dylanClass		Structure
hi def link dylanClassMods		StorageClass
hi def link dylanComment		Comment
hi def link dylanConditional	Conditional
hi def link dylanConstant		Constant
hi def link dylanException		Exception
hi def link dylanHeader		Macro
hi def link dylanImport		Include
hi def link dylanLabel		Label
hi def link dylanMiscMods		StorageClass
hi def link dylanNumber		Number
hi def link dylanOther		Keyword
hi def link dylanOperator		Operator
hi def link dylanParamDefs		Keyword
hi def link dylanPrecondit		PreCondit
hi def link dylanRepeat		Repeat
hi def link dylanSimpleDefs	Keyword
hi def link dylanStatement		Macro
hi def link dylanString		String
hi def link dylanVariable		Identifier


let b:current_syntax = "dylan"

" vim:ts=8