javascriptの補完時にもう少し情報を多く載せるパッチ
VimperatorのJavaScript補完のリストに載る情報が少ないのでパッチを作った。
typeof
から得られる結果が、number
,string
,boolean
の場合は値が表示されるけど、object
の場合に何も表示されない。特にnull
であってもtypeof
はobject
を返すので時々腹立たしい思いをする。
javascript_completion.patch
Index: src/content/completion.js =================================================================== RCS file: /cvs/vimperator/src/content/completion.js,v retrieving revision 1.93 diff -u -r1.93 completion.js --- src/content/completion.js 19 Sep 2008 10:33:12 -0000 1.93 +++ src/content/completion.js 20 Sep 2008 18:21:08 -0000 @@ -326,6 +326,17 @@ " if (type == 'number' || type == 'string' || type == 'boolean') {" + " value = obj[i];" + " comp.push([[i], type + ': ' + value]); }" + + " else if (type == 'object') {" + + " if (obj[i] === null){" + + " comp.push([[i], '(null)']); }"+ + " else if (obj[i] instanceof Array){" + + " comp.push([[i], 'Array: ' + obj[i].toString()]); }"+ + " else {" + + " comp.push([[i], type + ': ' + obj[i].toString()]); } }" + + " else if (type == 'function') {" + + " comp.push([[i], obj[i].toString()]); }" + + " else if (type == 'xml') {" + + " comp.push([[i], type + ': ' + obj[i].toXMLString()]); }" + " else {" + " comp.push([[i], type]); }" + "} comp;"