Skip to content

fix(doc): prevent docmap crash#269

Merged
davidgranstrom merged 1 commit into
davidgranstrom:mainfrom
salkin-mada:doc-fix
Jun 15, 2026
Merged

fix(doc): prevent docmap crash#269
davidgranstrom merged 1 commit into
davidgranstrom:mainfrom
salkin-mada:doc-fix

Conversation

@salkin-mada

Copy link
Copy Markdown
Contributor
➜ nvim --version
NVIM v0.12.2
Build type: Release
LuaJIT 2.1.1774896198

I met a weird issue with :SCNvimGenerateAssets and opening helpfiles.
The first time I hit K (SCNvimHelp) I would get:

SCDoc: Indexing help-files...
ERROR: Message 'escapeChar' not understood.
RECEIVER:
   Character 68 'D'
ARGS:
   Character 34 '"'
KEYWORD ARGUMENTS:
CALL STACK:
	DoesNotUnderstandError:reportError
		arg this = <instance of DoesNotUnderstandError>
	Nil:handleError
		arg this = nil
		arg error = <instance of DoesNotUnderstandError>
	Thread:handleError
		arg this = <instance of Thread>
		arg error = <instance of DoesNotUnderstandError>
	Object:throw
		arg this = <instance of DoesNotUnderstandError>
	Object:doesNotUnderstand
		arg this = $D
		arg selector = 'escapeChar'
		arg args = [*1]
		arg kwargs = [*0]
	< closed FunctionDef >
		arg x = $D
	< FunctionDef in Method Collection:collectAs >
		arg elem = $D
		arg i = 0
	ArrayedCollection:do
		arg this = "Document"
		arg function = <instance of Function>
		var i = 0
	Collection:collectAs
		arg this = "Document"
		arg function = <instance of Function>
		arg class = <instance of Meta_String>
		var res = ""
	SCNvimDocEntry:prJSONList
		arg this = <instance of SCNvimDocEntry>
		arg stream = <instance of File>
		arg key = "subclasses"
		arg v = "Document"
		arg lastItem = true
		var delimiter = ""
	ArrayedCollection:do
		arg this = [*2]
		arg function = <instance of Function>
		var i = 1
	SCNvimDocEntry:toJSON
		arg this = <instance of SCNvimDocEntry>
		arg stream = <instance of File>
		arg lastItem = false
		var delimiter = ","
		var inheritance = [*2]
		var numItems = 1
		var keys = [*3]
	< FunctionDef in Method Dictionary:do >
		arg key = "Classes/Document"
		arg value = <instance of SCNvimDocEntry>
		arg i = 2710
	Dictionary:keysValuesArrayDo
		arg this = <instance of Dictionary>
		arg argArray = [*16384]
		arg function = <instance of Function>
		var i = 16188
		var j = 2711
		var key = nil
		var val = nil
		var arraySize = nil
	Dictionary:keysValuesDo
		arg this = <instance of Dictionary>
		arg function = <instance of Function>
	Dictionary:do
		arg this = <instance of Dictionary>
		arg function = <instance of Function>
...
^^ ERROR: Message 'escapeChar' not understood.
RECEIVER: D

SCNvimDocEntry.toJSON created inheritance by appending superclasses and subclasses as arrays. But the implementor (implKlass) as a string.

prJSONList does v.collect {|x| "\"" ++ x.escapeChar($") ++ "\""}. Given the bare implementor String, collect iterates the string's characters and calls escapeChar on them, throwing DoesNotUnderstand: 'escapeChar' and aborting/crashing the entire docmap export. WHich leaves docmap.json broken.

This is fixed by pairing each key with its value and wrap the implementor name in an array, so prJSONList always receives a list.

SCNvimDocEntry.toJSON created `inheritance` by appending superclasses
and subclasses as arrays. But the implementor (implKlass) as a string.

`prJSONList` does `v.collect {|x| "\"" ++ x.escapeChar($") ++ "\""}`.
Given the bare implementor String, `collect` iterates the string's
characters and calls escapeChar on them, throwing `DoesNotUnderstand:
'escapeChar'` and aborting/crashing the entire docmap export. WHich
leaves docmap.json broken.

This is fixed by pairing each key with its value and wrap the
implementor name in an array, so prJSONList always receives a list.
@salkin-mada

Copy link
Copy Markdown
Contributor Author

Ah sorry for the noise @davidgranstrom! I totally missed: #267
This PR introduces a minimal change and targets the issue simply by always creating a list. For me this fixes the issue — I haven't tested the other PR.

@salkin-mada

salkin-mada commented Jun 12, 2026

Copy link
Copy Markdown
Contributor Author

Sorry I am not awake — on a train from Nollåtta-stan to Oschlu.. ZzzZzzzzzZzz

@davidgranstrom

Copy link
Copy Markdown
Owner

Thanks for this! Just tested and looks good. I will merge this rather than #267 simply because this touches a smaller surface area of the code and still fixes the same issue.

(Hope you also agree with this decision @bsssssss, and thank you for your PR none the less).

@davidgranstrom davidgranstrom merged commit b7d4885 into davidgranstrom:main Jun 15, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants