Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

suggestion: all detected tasks should be generated in the task.json #4219

Closed
chrisdias opened this issue Mar 15, 2016 · 7 comments
Closed

suggestion: all detected tasks should be generated in the task.json #4219

chrisdias opened this issue Mar 15, 2016 · 7 comments
Labels
tasks Task system issues
Milestone

Comments

@chrisdias
Copy link
Member

testing #4019

i created this gruntfile (based on http://gruntjs.com/getting-started), selected grunt from the list, and it didnt scaffold out any tasks. not sure what the expected behavior is, but the message in the list says that tasks will be auto detected.

module.exports = function(grunt) {

  // Project configuration.
  grunt.initConfig({
    pkg: grunt.file.readJSON('package.json'),
    uglify: {
      options: {
        banner: '/*! <%= pkg.name %> <%= grunt.template.today("yyyy-mm-dd") %> */\n'
      },
      build: {
        src: 'src/<%= pkg.name %>.js',
        dest: 'build/<%= pkg.name %>.min.js'
      }
    }
  });

  // Load the plugin that provides the "uglify" task.
  grunt.loadNpmTasks('grunt-contrib-uglify');

  // Default task(s).
  grunt.registerTask('default', ['uglify']);

};

and here is the tasks.json created

{
    // See http://go.microsoft.com/fwlink/?LinkId=733558
    // for the documentation about the tasks.json format
    "version": "0.1.0",
    "command": "grunt",
    "isShellCommand": true,
    "args": ["--no-color"],
    "showOutput": "silent"
}
@chrisdias chrisdias added this to the March 2016 milestone Mar 15, 2016
@egamma egamma added the tasks Task system issues label Mar 15, 2016
@egamma
Copy link
Member

egamma commented Mar 15, 2016

We should inform the user about the result of the auto detection in particular when auto detection isn't successful.

@dbaeumer
Copy link
Member

@egamma I have an issue about letting the user know the outcome of the auto detection. I will move this to you since you 'own' the grunt detection :-) to look into why it fails.

@dbaeumer dbaeumer assigned egamma and unassigned dbaeumer Mar 15, 2016
@egamma
Copy link
Member

egamma commented Mar 16, 2016

Auto detection detects build or test tasks. The grunt file above only registers a 'default` task.

Verified that the grungtfile below, detects the test task

{
    // See http://go.microsoft.com/fwlink/?LinkId=733558
    // for the documentation about the tasks.json format
    "version": "0.1.0",
    "command": "grunt",
    "isShellCommand": true,
    "tasks": [
        {
            "taskName": "test",
            "args": [],
            "isTestCommand": true
        }
    ]
}

gruntfile.js

module.exports = function(grunt) {

  grunt.initConfig({
    pkg: grunt.file.readJSON('package.json'),
    concat: {
      options: {
        separator: ';'
      },
      dist: {
        src: ['src/**/*.js'],
        dest: 'dist/<%= pkg.name %>.js'
      }
    },
    uglify: {
      options: {
        banner: '/*! <%= pkg.name %> <%= grunt.template.today("dd-mm-yyyy") %> */\n'
      },
      dist: {
        files: {
          'dist/<%= pkg.name %>.min.js': ['<%= concat.dist.dest %>']
        }
      }
    },
    qunit: {
      files: ['test/**/*.html']
    },
    jshint: {
      files: ['Gruntfile.js', 'src/**/*.js', 'test/**/*.js'],
      options: {
        // options here to override JSHint defaults
        globals: {
          jQuery: true,
          console: true,
          module: true,
          document: true
        }
      }
    },
    watch: {
      files: ['<%= jshint.files %>'],
      tasks: ['jshint', 'qunit']
    }
  });

  grunt.loadNpmTasks('grunt-contrib-uglify');
  grunt.loadNpmTasks('grunt-contrib-jshint');
  grunt.loadNpmTasks('grunt-contrib-qunit');
  grunt.loadNpmTasks('grunt-contrib-watch');
  grunt.loadNpmTasks('grunt-contrib-concat');

  grunt.registerTask('test', ['jshint', 'qunit']);

  grunt.registerTask('default', ['jshint', 'qunit', 'concat', 'uglify']);

};

@egamma egamma closed this as completed Mar 16, 2016
@chrisdias
Copy link
Member Author

OK, but it is not obvious that we do this and in many cases it looks like a bug. If i have a grunt/gulp file and do "task " from the command palette i see all of the tasks found in the file. As a user, my expectation is that we scaffold out a wrapper for each of those tasks.

So, i'm reopening this but moving it to the backlog.

@chrisdias chrisdias reopened this Mar 18, 2016
@chrisdias chrisdias modified the milestones: Backlog, March 2016 Mar 18, 2016
@egamma
Copy link
Member

egamma commented Mar 18, 2016

If i have a grunt/gulp file and do "task " from the command palette i see all of the tasks found in the file. As a user, my expectation is that we scaffold out a wrapper for each of those tasks.

@chrisdias The Tasks integration understands grunt, gulp, jake tasks and therefore doesn't need a scaffolding for each task. What the task integration cannot know is 1) which of these tasks is the build or test tasks. It can also not know which problem matcher should be used. This additional information needs to be defined in the tasks.json.

@egamma egamma removed their assignment Mar 18, 2016
@egamma egamma added the feature-request Request for new features or functionality label Mar 18, 2016
@chrisdias
Copy link
Member Author

yes, understood, but perhaps I would like to customize each of the tasks. Having them scaffolded in tasks.json should not change any behavior but it lets me see the connection between the full list of tasks we detect and how tasks.json can be used to augment each task.

@egamma egamma changed the title gruntfile not detected when creating task.json suggestion: all detected tasks should be generated in the task.json Mar 30, 2016
@dbaeumer
Copy link
Member

I am closing this. In task 2.0.0 you can now configure individual tasks using a menu entry and we add the necessary scaffold to the tasks.json.

With contributable task providers we can't generate scaffolds for all tasks anyways.

@dbaeumer dbaeumer removed the feature-request Request for new features or functionality label Nov 10, 2017
@vscodebot vscodebot bot locked and limited conversation to collaborators Dec 25, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
tasks Task system issues
Projects
None yet
Development

No branches or pull requests

3 participants