language-babel icon indicating copy to clipboard operation
language-babel copied to clipboard

`Callback must be a function` when using a custom tagged template grammar

Open pfgithub opened this issue 7 years ago • 13 comments

Setting a custom tagged template grammar like csscustom:source.css and using it on a file

let csscustom = () => {};
csscustom`
a{
  color:#fff;
}
`;

produces a warning Callback must be a function and does not highlight the text differently

settings page with template literal grammar set image of code above callback must be a function

pfgithub avatar Jan 20 '19 23:01 pfgithub

Same issue...

lasbian avatar Aug 18 '19 18:08 lasbian

By installing Node v10 (LTS) instead of using v12, I got rid of the warning message Callback must be a function. But my custom tagged template grammar extensions are currently not working on my new mac/atom setup.

tujoworker avatar Aug 22 '19 09:08 tujoworker

Was already running the v10 (LTS) :/

lasbian avatar Aug 22 '19 19:08 lasbian

Same issue here. Possible related issue: are gql code highlighted on your setup with following example ?

const typeDefs = gql`
  type Query {
    test: String
  }
`;

This highlight should be working without custom tagged template grammar, because shipped by default with the plugin, but is also not working anymore on my setup (OSX, tested with node 10, 11, 12).

pyrou avatar Sep 06 '19 21:09 pyrou

Same!

waspeer avatar Sep 14 '19 20:09 waspeer

Just for good measure, here's the error stack of Atom:

Uncaught (in promise) NodeError: Callback must be a function at makeCallback (fs.js:165:11) at Object.fs.unlink (fs.js:1048:14) at getTtlGrammarFiles.then.ttlGrammarFiles (/.../.atom/packages/language-babel/lib/create-ttl-grammar.js:260:12)

  NodeError @ internal/errors.js:157
  makeCallback @ fs.js:165
  fs.unlink @ fs.js:1048
  getTtlGrammarFiles.then.ttlGrammarFiles @ create-ttl-grammar.js? [sm]:271
  Promise.catch (async)    
  doesGrammarFileExist.then.ifFileExists @ create-ttl-grammar.js? [sm]:54
  Promise.then (async)    
  Promise @ create-ttl-grammar.js? [sm]:48
  createGrammar @ create-ttl-grammar.js? [sm]:46
  configChangedTimer.setTimeout @ create-ttl-grammar.js? [sm]:222

Related: https://github.com/gruntjs/grunt-contrib-jasmine/issues/266

christiaanwesterbeek avatar Oct 15 '19 08:10 christiaanwesterbeek

The same problem occurs for me when setting the following tagged template grammar:

Anmærkning 2020-02-14 000454

Axedyson avatar Feb 13 '20 23:02 Axedyson

This is still the case today... super frustrating. Having the same problem on a new mac, fresh installation of Atom and up to date language-babel package.

paulobarcelos avatar Aug 26 '20 13:08 paulobarcelos

I am experiencing the same issue. Setting:

html:text.html.basic

Versions:

screenshot

Navigatron avatar Aug 31 '20 23:08 Navigatron

The same problem occurs for me when setting the following tagged template grammar:

Anmærkning 2020-02-14 000454

Experiencing similar issue with /* @html */:text.html.basic

tiffting avatar Nov 04 '20 15:11 tiffting

I have the same issue with .mjs files using template literals. My plugin list is: atom-beautify busy-signal docblockr file-icons highlight-selected hyperclick ide-css intentions language-babel language-javascript-plus linter (maybe incompatible?) linter-eslint (maybe incompatible?) linter-jshint (maybe incompatible?) linter-ui-default (maybe incompatible?) remember-folds remote-ftp

eminvegan avatar Jan 10 '21 19:01 eminvegan

Problem still exists since now more than 2 years. Does anybody think it will be solved? I appreciate to get a solution because changing from VS Code to Atom does not get easier with such problems (I code in js and html and want to use this feature as an replacement for the ES6-html Plugin of VS-Code (which marks html in template strings).

bruns8234 avatar Mar 23 '21 14:03 bruns8234

Same there since 3 years

tinbka avatar Mar 31 '22 10:03 tinbka