<small id='REj8Y'></small><noframes id='REj8Y'>

    1. <legend id='REj8Y'><style id='REj8Y'><dir id='REj8Y'><q id='REj8Y'></q></dir></style></legend>

      • <bdo id='REj8Y'></bdo><ul id='REj8Y'></ul>
      <i id='REj8Y'><tr id='REj8Y'><dt id='REj8Y'><q id='REj8Y'><span id='REj8Y'><b id='REj8Y'><form id='REj8Y'><ins id='REj8Y'></ins><ul id='REj8Y'></ul><sub id='REj8Y'></sub></form><legend id='REj8Y'></legend><bdo id='REj8Y'><pre id='REj8Y'><center id='REj8Y'></center></pre></bdo></b><th id='REj8Y'></th></span></q></dt></tr></i><div id='REj8Y'><tfoot id='REj8Y'></tfoot><dl id='REj8Y'><fieldset id='REj8Y'></fieldset></dl></div>
      <tfoot id='REj8Y'></tfoot>
      1. 获取vscode中任务文件的相对路径

        时间:2023-05-28
        <i id='fo76G'><tr id='fo76G'><dt id='fo76G'><q id='fo76G'><span id='fo76G'><b id='fo76G'><form id='fo76G'><ins id='fo76G'></ins><ul id='fo76G'></ul><sub id='fo76G'></sub></form><legend id='fo76G'></legend><bdo id='fo76G'><pre id='fo76G'><center id='fo76G'></center></pre></bdo></b><th id='fo76G'></th></span></q></dt></tr></i><div id='fo76G'><tfoot id='fo76G'></tfoot><dl id='fo76G'><fieldset id='fo76G'></fieldset></dl></div>

            1. <tfoot id='fo76G'></tfoot>

                <legend id='fo76G'><style id='fo76G'><dir id='fo76G'><q id='fo76G'></q></dir></style></legend>
                  <bdo id='fo76G'></bdo><ul id='fo76G'></ul>

                    <tbody id='fo76G'></tbody>
                • <small id='fo76G'></small><noframes id='fo76G'>

                  本文介绍了获取vscode中任务文件的相对路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  限时送ChatGPT账号..

                  我在 vscode 的 tasks.json 文件中定义了一个任务,如下所示

                  <代码>{版本":0.1.0",任务": [{命令":吞咽","taskName": "eslint_task",参数":[埃斯林特","- 文件",${文件}"],回声命令":真}]}

                  ${file} 为我提供了运行此命令的文件的绝对路径(在 macOS 中从 /Volumes 开始).有什么方法可以获取同一文件的相对路径(从工作区文件夹开始的路径)?

                  我已经查看了任务的官方文档,但找不到任何那里的参数列表.

                  解决方案

                  找到了答案.我只需要使用 ${relativeFile} 而不是 ${file}.

                  这是我找到的占位符列表 -

                  • ${workspaceRoot}:工作区根文件夹
                  • ${file}:保存文件的路径
                  • ${relativeFile}:保存文件的相对路径
                  • ${fileBasename}:保存文件的基本名称
                  • ${fileDirname}:保存文件的目录名
                  • ${fileExtname}:保存文件的扩展名(包括.)
                  • ${fileBasenameNoExt}:保存文件的基本名称,不带扩展名
                  • ${cwd}:当前工作目录

                  来源:取自这里.p>

                  I have a task defined in vscode's tasks.json file as following

                  {
                      "version": "0.1.0",
                      "tasks": [
                          {
                              "command": "gulp",
                              "taskName": "eslint_task",
                              "args": [
                                  "eslint",
                                  "--file",
                                  "${file}"
                              ],
                              "echoCommand": true
                          }
                      ]
                  }
                  

                  The ${file} is providing me the absolute path (starting from /Volumes in macOS) of the file on which I run this command. Is there any way I can get the relative path (Path starting from the workspace folder) of the same file instead?

                  I already checked the official documentation for tasks, but couldn't find any list of arguments there.

                  解决方案

                  Found the answer. I just need to use ${relativeFile} instead of ${file}.

                  Here's the list of placeholder I have found -

                  • ${workspaceRoot}: workspace root folder
                  • ${file}: path of saved file
                  • ${relativeFile}: relative path of saved file
                  • ${fileBasename}: saved file's basename
                  • ${fileDirname}: directory name of saved file
                  • ${fileExtname}: extension (including .) of saved file
                  • ${fileBasenameNoExt}: saved file's basename without extension
                  • ${cwd}:current working directory

                  Source: Taken from here.

                  这篇关于获取vscode中任务文件的相对路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:任何等效的 gulp 插件用于执行“grunt bower"? 下一篇:任务名称的 Gulp.js 约定

                  相关文章

                  最新文章

                  <legend id='sNlRx'><style id='sNlRx'><dir id='sNlRx'><q id='sNlRx'></q></dir></style></legend>
                  • <bdo id='sNlRx'></bdo><ul id='sNlRx'></ul>

                      <tfoot id='sNlRx'></tfoot>

                    1. <i id='sNlRx'><tr id='sNlRx'><dt id='sNlRx'><q id='sNlRx'><span id='sNlRx'><b id='sNlRx'><form id='sNlRx'><ins id='sNlRx'></ins><ul id='sNlRx'></ul><sub id='sNlRx'></sub></form><legend id='sNlRx'></legend><bdo id='sNlRx'><pre id='sNlRx'><center id='sNlRx'></center></pre></bdo></b><th id='sNlRx'></th></span></q></dt></tr></i><div id='sNlRx'><tfoot id='sNlRx'></tfoot><dl id='sNlRx'><fieldset id='sNlRx'></fieldset></dl></div>

                      <small id='sNlRx'></small><noframes id='sNlRx'>