I'm writing a technical document in LyX (version 220.127.116.11 for Windows) and I'm using Hunspell for spell checking.
Throughout the text, there are code snippets which I've formatted with the "Code" text style (from the "Logical Markup" module). Obviously, most of these snippets are not valid German, so every single code snippet has a dotted red line (see screenshot).
Is there a way to tell Hunspell to ignore all text formatted as code?
Yes, the idea is to add a local version of the Logical Markup module. Here are the steps below for LyX 2.1, which should be released in a couple of days.
Locate the Logical Markup module: Go to Help > About and under "Library directory:" you will see a path such as /usr/share/lyx/ (this is what shows up on Ubuntu). In that folder, there is a folder "layouts" and inside that there is a file named "logicalmkup.module".
Locate your user directory: Go to Help > About and it will show you. On Linux it is under ~/.lyx. Inside that directory there is a folder "layouts". Copy the file you found above, "logicalmkup.module", to this "layouts" directory.
Customize that module. Open it up and add spellcheck 0 to the part relating to the "code" inset.
Start LyX and go to Tools > Reconfigure.
For more information, see Help > Customization. Below I give the relevant part of the file after adding the spellcheck (after step 3). Note that for you it might be different on 2.0.5. Do not just copy what I post here because the formats are different. I just provide it to show how and where to add the line.