mirror of
https://github.com/neovim/neovim.git
synced 2026-08-28 18:11:47 +00:00
refactor(tutor): use inline comments instead of json file #39714
Problem: Expected text for interactive marks is in a separate json file from the tutor file. When the tutor file is updated, line numbers (potentially many) have to be updated in the json file. This is a burden for maintenance and automatic testing. Solution: Put the expected text inline in the tutor file, marked with `[[]]`. Parse and remove the comments before opening the tutor file so extmarks can be applied.
This commit is contained in:
@@ -12,10 +12,9 @@ function! tutor#SetupVim()
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" Loads metadata file, if available
|
||||
" Load inline metadata
|
||||
function! tutor#LoadMetadata()
|
||||
let l:metadata_file = exists('b:tutor_file') ? b:tutor_file : expand('%')
|
||||
let b:tutor_metadata = json_decode(readfile(l:metadata_file .. '.json'))
|
||||
lua require('nvim.tutor').load_metadata()
|
||||
endfunction
|
||||
|
||||
" Mappings: {{{1
|
||||
|
||||
Reference in New Issue
Block a user