Code folding in json files

Hi guys,

somebody knows why code folding is not available in json files? I always get an error saying:

Code selection doesn’t work when folding is off

I neither know where to find this option nor why it works in every other type of file - except json.
I just know that the folding-line on the left of the editor is not available when working with json files.

Thanks for any tips,
regards Daniel

Hi, please ensure folding is turned on in Edit > Preferences > Editing > Smart Editing > Folding.

Hi mitchell,

this option is already activated:

That’s odd. I have JSON folding working in a stock Komodo install. Do you still have a problem when you restart Komodo in safe mode? Help > Troubleshooting > Restart in Safe Mode.

Hi mitchell,

yes, still not working in safe mode - although i got another error saying:

Cannot run code for this type of file please select a supported language

It’s just a pure simple json file, bracket highlighting also works so i see no problem why block selection shouldn’t.

Hi, I have a simple JSON file too. I put the caret on line two, select Edit > Select > Select Block, and get the expected result. Screenshots below for context. Would you please share the content of your Help > Troubleshooting > View Log File?

Sure:

[2017-04-25 17:25:34,519] [INFO] Startup: Welcome to Komodo IDE 10.2.1 build 89853 (platform win32-x86, running on Windows post2012Server version 6.3.9600)
[2017-04-25 17:25:34,519] [INFO] Startup: C:\Program Files (x86)\ActiveState Komodo IDE 10\lib\mozilla\komodo.exe built on Wed Mar 08 12:38:48 2017
[2017-04-25 17:25:35,154] [WARNING] console-logger: mutating the [[Prototype]] of an object will cause your code to run very slowly; instead create the object with the correct initial [[Prototype]] value using Object.create (1) in resource://gre/modules/Preferences.jsm:381
[2017-04-25 17:25:35,319] [WARNING] root: ko.logging has been converted to a CommonJS module; use require(“ko/logging”) instead (since Komodo 9.0.0a1).
@chrome://komodo/content/komodo.js:15:1

[2017-04-25 17:25:36,177] [WARNING] keybindings: [Ctrl+0] was used for ‘cmd_goToQuickBookmark_0’, overriding to use ‘cmd_fontZoomReset’
[2017-04-25 17:25:36,553] [INFO] koInitService: Adding pre startup service for ‘koFileStatusService’: ‘@activestate.com/koFileStatusService;1’
[2017-04-25 17:25:36,674] [INFO] elastic_tabstops: Elastic tabstops loaded.
[2017-04-25 17:25:36,723] [INFO] komodospellchecker: Spell checker loaded.
[2017-04-25 17:25:36,723] [INFO] komodospellchecker: Using dictionary en-US
[2017-04-25 17:25:38,845] [WARNING] console-logger: mutating the [[Prototype]] of an object will cause your code to run very slowly; instead create the object with the correct initial [[Prototype]] value using Object.create (1) in file:///C:/Program%20Files%20(x86)/ActiveState%20Komodo%20IDE%2010/lib/mozilla/components/koamAddonManager.js:138
[2017-04-25 17:25:39,130] [WARNING] console-logger: XUL box for tab element contained an inline #text child, forcing all its children to be wrapped in a block. (1) in chrome://unittest/content/views/panel.xul:0
[2017-04-25 17:25:39,130] [WARNING] console-logger: XUL box for tab element contained an inline #text child, forcing all its children to be wrapped in a block. (1) in chrome://unittest/content/views/panel.xul:0
[2017-04-25 17:25:39,130] [WARNING] console-logger: XUL box for tab element contained an inline #text child, forcing all its children to be wrapped in a block. (1) in chrome://unittest/content/views/panel.xul:0
[2017-04-25 17:25:39,144] [WARNING] console-logger: XUL box for tab element contained an inline #text child, forcing all its children to be wrapped in a block. (1) in chrome://unittest/content/views/panel.xul:0
[2017-04-25 17:25:39,144] [WARNING] console-logger: XUL box for tab element contained an inline #text child, forcing all its children to be wrapped in a block. (1) in chrome://unittest/content/views/panel.xul:0
[2017-04-25 17:25:39,144] [WARNING] console-logger: XUL box for tab element contained an inline #text child, forcing all its children to be wrapped in a block. (1) in chrome://unittest/content/views/panel.xul:0
[2017-04-25 17:25:39,984] [INFO] koInitService: Adding pre startup service for ‘KoMemoryReporter’: ‘@activestate.com/koMemoryReporter;1’
[2017-04-25 17:25:40,000] [INFO] koInitService: Adding pre startup service for ‘koCommandmentService’: ‘@activestate.com/koCommandmentService;1’
[2017-04-25 17:25:40,000] [INFO] koInitService: Adding pre startup service for ‘koDBGPManager’: ‘@activestate.com/koDBGPManager;1’
[2017-04-25 17:25:40,016] [WARNING] console-logger: XUL box for tab element contained an inline #text child, forcing all its children to be wrapped in a block. (1) in chrome://unittest/content/views/panel.xul:0
[2017-04-25 17:25:40,016] [WARNING] console-logger: XUL box for tab element contained an inline #text child, forcing all its children to be wrapped in a block. (1) in chrome://unittest/content/views/panel.xul:0
[2017-04-25 17:25:40,016] [WARNING] console-logger: XUL box for tab element contained an inline #text child, forcing all its children to be wrapped in a block. (1) in chrome://unittest/content/views/panel.xul:0
[2017-04-25 17:25:40,713] [ERROR] codeintel.komodo.KoCodeIntelManager: failed to get langAppInfo.version for language JavaScript
[2017-04-25 17:25:47,063] [ERROR] koScopeDocs-Py: Could not find cix for ext
[2017-04-25 17:25:47,063] [ERROR] koScopeDocs-Py: Could not find cix for html5
[2017-04-25 17:27:43,700] [WARNING] views: Inconsistent view count in view_closed event
[2017-04-25 17:27:43,938] [WARNING] views: Inconsistent view count in view_opened event
[2017-04-25 17:28:44,381] [WARNING] console-logger: Key event not available on GTK2: key=“u” modifiers=“control,shift” (1) in chrome://komodo/content/komodo.xul:0
[2017-04-25 17:28:44,381] [WARNING] console-logger: Key event not available on some keyboard layouts: key=“w” modifiers=“control,alt” (1) in chrome://komodo/content/komodo.xul:0
[2017-04-25 17:28:44,382] [WARNING] console-logger: Key event not available on some keyboard layouts: key=“n” modifiers=“control,alt” (1) in chrome://komodo/content/komodo.xul:0
[2017-04-25 17:28:44,382] [WARNING] console-logger: Key event not available on some keyboard layouts: key=“s” modifiers=“control,alt” (1) in chrome://komodo/content/komodo.xul:0
[2017-04-25 17:28:44,382] [WARNING] console-logger: Key event not available on some keyboard layouts: key=“d” modifiers=“control,alt,shift” (1) in chrome://komodo/content/komodo.xul:0
[2017-04-25 17:29:42,528] [WARNING] console-logger: Key event not available on GTK2: key=“u” modifiers=“control,shift” (1) in chrome://komodo/content/tail/tail.xul:0
[2017-04-25 17:29:42,528] [WARNING] console-logger: Key event not available on some keyboard layouts: key=“w” modifiers=“control,alt” (1) in chrome://komodo/content/tail/tail.xul:0
[2017-04-25 17:29:42,528] [WARNING] console-logger: Key event not available on some keyboard layouts: key=“n” modifiers=“control,alt” (1) in chrome://komodo/content/tail/tail.xul:0
[2017-04-25 17:29:42,528] [WARNING] console-logger: Key event not available on some keyboard layouts: key=“s” modifiers=“control,alt” (1) in chrome://komodo/content/tail/tail.xul:0
[2017-04-25 17:29:42,528] [WARNING] console-logger: Key event not available on some keyboard layouts: key=“d” modifiers=“control,alt,shift” (1) in chrome://komodo/content/tail/tail.xul:0

I had to copy the text manually from the text file because everytime i tried to STRG+C via the troubleshooting window log, Komodo became unresponsive for about 20 seconds…don’t know whats going on here…

Okay, there’s nothing in the log that indicates an issue with block selection. Does this happen in any JSON file? For example, the one in my screenshot?

Your json file is working.
I have a larger json file with a few megabytes, it’s a valid and well formed geoJson file. You can test it on your own:

Testfile

Hi, Komodo automatically loads large files as plain text and shows you a dialog indicating so (unless you had previously checked the “do not notify me again” box). Once you explicitly set the language to JSON, you’ll get syntax highlighting, folding, and then Edit > Select > Select Block.

Thanks mitchell, that did the trick.

I haven’t seen that komodo automatically displayed this as plain text.
Is there any way do define the size from when komodo displays files as text only?

Hi, it doesn’t look like this is configurable. However, you can get the Komodo prompt back by unchecking Edit > Preferences > Editor > Confirmation Dialogs > Do not alert me when a large buffer will be treated as plain text.