yabab-dev/ng2-codemirror

Colors not appearing on code passed to codemirror.

xino1010 opened this issue · 1 comments

<codemirror [(ngModel)]="code" [config]="codeConfiguration"></codemirror>

private code: string = "#ifndef flow_H\n#define flow_H\n\n#include <pthread.h>\n#include <semaphore.h>\n#include <time.h>\nsem_t sem_main_to_0;\nsem_t sem_0_to_1;\nsem_t sem_1_to_main;\nsem_t sem_periodic_1;\n\n\npthread_t threadPosix11_id, threadPosix12_id;\nstruct timespec ts;\t\t//struct defined in time.h, we use to control a timedwait semaphore\nstruct timespec ts0;\t\t//struct defined in time.h, we use to control a timedwait semaphore\nstruct timespec tsP;\t\t//struct defined in time.h, we use to control a timedwait semaphore\nstruct sched_param param;\n\nvoid *flow (void *id);\n\n//void *task_flow(void *id);\nvoid *threadPosix11 (void *id);\nvoid *threadPosix12 (void *id);\n\n#endif /* flow_H */\n"; private codeConfiguration: any = { indentWithTabs: false, lineNumbers: true, readOnly: 'nocursor', lineWrapping: true, matchBrackets: true, mode: 'text/x-c++src', viewportMargin: 200 };

angular-cli.json
"styles": [ "../node_modules/codemirror/lib/codemirror.css", "styles.scss" ], "scripts": [ "../node_modules/codemirror/lib/codemirror.js" ],

What is it missing?

image

It was missing to import mode at the beginning.

import 'codemirror/mode/clike/clike';