简体   繁体   English

在Java文件Sublime Text 3中将“ //”更改为注释

[英]Change '//' as comment out in Javascript file Sublime Text 3

I want to change "//" in my sublime text 3 to not comment out the following inline text. 我想在崇高文字3中更改“ //”,以不注释掉以下内联文字。

I'm using backticks to plug a variable into a URL and Sublime Text is not ignoring the contents, but commenting out the following characters. 我正在使用反引号将变量插入URL,Sublime Text不会忽略内容,而是注释掉以下字符。

Can I make a less-used series of keystokes be my comment out, like "\\\\" for example? 我可以将使用较少的一系列按键作为注释,例如“ \\\\”吗? Here's what it looks like. 这是它的样子。

Here is my code in my .js file: 这是我的.js文件中的代码:

function getPhotosForSearch (searchQuery) {
  var url = `${CORS_PROXY}${FLICKR_API_URL}${FLICKR_API_KEY}&text=${searchQuery}`;

  return (
fetch(url)
.then(response => response.json())
.then(res => {
  return res.photos.photo.map(photo => {
    var photoData = {
      large: `https://farm${photo.farm}.staticflickr.com/${photo.server}/${photo.id}_${photo.secret}_b.jpg`,
      thumb: `https://farm${photo.farm}.staticflickr.com/${photo.server}/${photo.id}_${photo.secret}_t.jpg`,
      title: photo.title
    }
    return createFlickrThumb(photoData);
  })
})
)

} }

You can install babel-sublime package. 您可以安装babel-sublime软件包。

Quoting from the docs, it supports: Language definitions for ES6+ JavaScript with React JSX syntax extensions. 从文档引用,它支持: 具有React JSX语法扩展的ES6 + JavaScript的语言定义。

Install with: CTRL + SHIFT + p , locate: Package Control: Install Package , and select Babel . 使用以下命令安装: CTRL + SHIFT + p ,找到: 程序包控制:安装程序包 ,然后选择Babel

Select it in ViewSyntaxOpen all with current extension as...JavaScript (Babel) 视图中选择它→ 语法以当前扩展名全部打开...JavaScript(Babel)

Your code with this environment: 您在此环境下的代码:

在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM