Skip to content

Commit 8e013b1

Browse files
benknoblechrisbra
authored andcommitted
runtime(racket): update Racket runtime files
This brings the included Racket runtime files to commit c41bc5a (indent for[*]/lists with accumulator clause correctly, 2024-11-12) of https://github.com/benknoble/vim-racket. Note that not all files from that repository are included. closes: #16046 Signed-off-by: D. Ben Knoble <ben.knoble+github@gmail.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
1 parent 9b05326 commit 8e013b1

4 files changed

Lines changed: 21 additions & 10 deletions

File tree

runtime/autoload/racket.vim

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
" Maintainer: D. Ben Knoble <ben.knoble+github@gmail.com>
22
" URL: https://github.com/benknoble/vim-racket
3-
" Last Change: 2023 Sep 22
3+
" Last Change: 2024 Nov 12
44
vim9script
55

66
def MakePatternFromLiterals(xs: list<string>): string
@@ -170,7 +170,7 @@ def PosLT(left: dict<any>, right: dict<any>): bool
170170
enddef
171171

172172
def IsForFold(word: string): bool
173-
return ['for/fold', 'for/foldr', 'for*/fold', 'for*/foldr']->index(word) >= 0
173+
return ['for/fold', 'for/foldr', 'for/lists', 'for*/fold', 'for*/foldr', 'for*/lists']->index(word) >= 0
174174
enddef
175175

176176
def IsSecondForm(blnum: number, bcol: number, vlnum: number): bool
@@ -209,5 +209,5 @@ def IsSecondForm(blnum: number, bcol: number, vlnum: number): bool
209209
endwhile
210210

211211
# assert_report(printf('forms seen pre-return: %d', forms_seen))
212-
return forms_seen == 2 || (forms_seen == 1 && !empty(stack))
212+
return (forms_seen == 2 && empty(stack)) || (forms_seen == 1 && !empty(stack))
213213
enddef

runtime/ftplugin/racket.vim

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
" Maintainer: D. Ben Knoble <ben.knoble+github@gmail.com>
44
" Previous Maintainer: Will Langstroth <will@langstroth.com>
55
" URL: https://github.com/benknoble/vim-racket
6-
" Last Change: 2024 May 28
6+
" Last Change: 2024 Jun 01
77

88
if exists("b:did_ftplugin")
99
finish
@@ -16,19 +16,20 @@ set cpo&vim
1616
" quick hack to allow adding values
1717
setlocal iskeyword=@,!,#-',*-:,<-Z,a-z,~,_,94
1818

19+
setlocal shiftwidth=2 softtabstop=2
20+
1921
" Enable auto begin new comment line when continuing from an old comment line
2022
setlocal comments=:;;;;,:;;;,:;;,:;
2123
setlocal formatoptions+=r
2224

23-
"setlocal commentstring=;;\ %s
24-
setlocal commentstring=#\|\ %s\ \|#
25+
setlocal commentstring=;;\ %s
2526

2627
setlocal formatprg=raco\ fmt
2728

2829
" Undo our settings when the filetype changes away from Racket
2930
" (this should be amended if settings/mappings are added above!)
3031
let b:undo_ftplugin =
31-
\ "setlocal iskeyword< lispwords< lisp< comments< formatoptions< formatprg<"
32+
\ "setlocal iskeyword< shiftwidth< softtabstop< comments< formatoptions< formatprg<"
3233
\. " | setlocal commentstring<"
3334

3435
if !exists("no_plugin_maps") && !exists("no_racket_maps")

runtime/indent/racket.vim

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
" Maintainer: D. Ben Knoble <ben.knoble+github@gmail.com>
44
" Previous Maintainer: Will Langstroth <will@langstroth.com>
55
" URL: https://github.com/benknoble/vim-racket
6-
" Last Change: 2024 Jan 31
6+
" Last Change: 2024 Nov 12
77

88
if exists("b:did_indent")
99
finish
@@ -21,6 +21,7 @@ setlocal lispwords+=λ
2121
setlocal lispwords+=with-handlers
2222
setlocal lispwords+=define-values,opt-lambda,case-lambda,syntax-rules,with-syntax,syntax-case,syntax-parse
2323
setlocal lispwords+=define-for-syntax,define-syntax-parser,define-syntax-parse-rule,define-syntax-class,define-splicing-syntax-class
24+
setlocal lispwords+=syntax/loc,quasisyntax/loc
2425
setlocal lispwords+=define-syntax-parameter,syntax-parameterize
2526
setlocal lispwords+=define-signature,unit,unit/sig,compund-unit/sig,define-values/invoke-unit/sig
2627
setlocal lispwords+=define-opt/c,define-syntax-rule
@@ -30,6 +31,11 @@ setlocal lispwords+=with-input-from-file,with-output-to-file
3031
setlocal lispwords+=begin,begin0
3132
setlocal lispwords+=place
3233
setlocal lispwords+=cond
34+
" Racket style indents if like a function application:
35+
" (if test
36+
" then
37+
" else)
38+
setlocal lispwords-=if
3339

3440
" Racket OOP
3541
" TODO missing a lot of define-like forms here (e.g., define/augment, etc.)
@@ -50,6 +56,7 @@ setlocal lispwords+=for/set,for*/set
5056
setlocal lispwords+=for/first,for*/first
5157
setlocal lispwords+=for/last,for*/last
5258
setlocal lispwords+=for/stream,for*/stream
59+
setlocal lispwords+=for/lists,for*/lists
5360

5461
setlocal lispwords+=match,match*,match/values,define/match,match-lambda,match-lambda*,match-lambda**
5562
setlocal lispwords+=match-let,match-let*,match-let-values,match-let*-values
@@ -66,4 +73,7 @@ setlocal lispwords+=if-view,case-view,cond-view,list-view,dyn-view
6673
setlocal lispwords+=case/dep
6774
setlocal lispwords+=define/obs
6875

76+
" rackunit
77+
setlocal lispwords+=define-simple-check,define-binary-check,define-check,with-check-info
78+
6979
let b:undo_indent = "setlocal lisp< ai< si< lw<" .. (has('vim9script') ? ' indentexpr< lispoptions<' : '')

runtime/syntax/racket.vim

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
" Previous Maintainer: Will Langstroth <will@langstroth.com>
55
" URL: https://github.com/benknoble/vim-racket
66
" Description: Contains all of the keywords in #lang racket
7-
" Last Change: 2023 Sep 22
7+
" Last Change: 2024 Apr 14
88

99
" Initializing:
1010
if exists("b:current_syntax")
@@ -30,7 +30,7 @@ endif
3030
" http://docs.racket-lang.org/reference/index.html
3131
"
3232
syntax keyword racketSyntax module module* module+ require provide quote
33-
syntax keyword racketSyntax #%datum #%expression #%top #%variable-reference #%app
33+
syntax keyword racketSyntax #%module-begin #%datum #%expression #%top #%variable-reference #%app
3434
syntax keyword racketSyntax lambda case-lambda let let* letrec
3535
syntax keyword racketSyntax let-values let*-values let-syntax letrec-syntax
3636
syntax keyword racketSyntax let-syntaxes letrec-syntaxes letrec-syntaxes+values

0 commit comments

Comments
 (0)