I re-booted my Mac today and from that point onwards my Ionic project has been full of red squiggly error lines on any of my absolute import paths. So previously an import such as:
import { myService } from "src/app/core/services/myService.service";
is now highlighted as an error.
Does anyone have any idea what might cause that or how I might fix it?
I’ve never used VSCode, but when WebStorm’s syntax highlighting does something similar, hovering one’s mouse over the offending bit causes an error message to appear. If you can’t get that to happen, does attempting to build the project from a CLI generate anything useful?
If builds work fine, I think that eliminates the possibility of it being a file permission problem. If it’s just happening in the IDE, then I would look at IDE-specific stuff. For example, JetBrains puts an .idea folder at the top level of the project that contains all IDE-specific information. Assuming VSCode does something similar, you could try closing VSCode, renaming that directory (I typically just add a “-broken” suffix; if it ends up not helping, you can easily rename it back and get yourself back to status quo ante), and then restarting VSCode. Or if it has an “invalidate project caches” or something feature, try that.
Renaming the folder made no difference. I just opened up another project in VS Code and that is fine - no import errors at all. That’s an older project with an older version of Typescript - maybe that’s something to do with it. This only happened after my Mac re-boot this morning though - first re-boot for a few weeks.
YMMV, but I’ve been using JetBrains products for over a decade and cannot say enough good things about them. I think they’re especially great for polyglot developers, because you get the same UI with special customization for whatever language you’re working in: C, JavaScript/TypeScript, HTML, Python, Go, SQL, Java, C#, Kotlin, whatever. Android Studio is based off the same codebase as well, so if you’ve any familiarity with it, it should carry over.