dart 在vscode中只在文件名旁边显示错误数

czq61nw1  于 5个月前  发布在  Vscode
关注(0)|答案(1)|浏览(43)

以前,VScode只在文件名旁边显示文件中错误的数量。但是现在它显示了问题的数量(警告+错误)。
如何让它只显示错误的数量?
当我设置“problems.decorations.enabled”:false时,它甚至不显示错误的数量。


的数据

vsikbqxv

vsikbqxv1#

使用此代码:

import 'dart:collection';

main() {
  List<int> values;
  // Queues are optimized for adding to the head or tail
  // Items cannot be accessed by their index.
  var q = new Queue.from([300, 200, 100, 500]);
  //var y;

  // Queues implement Iterable:
  print(q.takeWhile((i) => i > 100));
  kgjrhru('x',x);

  // Consuming a queue
  while(q.first > 100) {
    q.removeFirst();
  }
  print(q);

  if (values !=null) {
    print(values.length);
  }
}

字符串
执行dart analyse test.dart,得到:

PS D:\TEMP> dart analyze test.dart
Analyzing test.dart...

  error • test.dart:12:3 • The function 'kgjrhru' isn't defined. Try importing the library that defines 'kgjrhru', correcting  
          the name to the name of an existing function, or defining a function named 'kgjrhru'. • undefined_function
  error • test.dart:12:15 • Undefined name 'x'. Try correcting the name to one that is defined, or defining the name. •        
          undefined_identifier
  error • test.dart:20:7 • The non-nullable local variable 'values' must be assigned before it can be used. Try giving it an   
          initializer expression, or ensure that it's assigned on every execution path. •
          not_assigned_potentially_non_nullable_local_variable
  error • test.dart:21:11 • The non-nullable local variable 'values' must be assigned before it can be used. Try giving it an  
          initializer expression, or ensure that it's assigned on every execution path. •
          not_assigned_potentially_non_nullable_local_variable
warning • test.dart:20:7 • The operand can't be null, so the condition is always 'false'. Try removing the condition, an       
          enclosing condition, or the whole conditional statement. • unnecessary_null_comparison
warning • test.dart:20:14 • The operand can't be null, so the condition is always 'true'. Remove the condition. •
          unnecessary_null_comparison

6 issues found.
PS D:\TEMP>


VS代码仍然显示6,而不是类似于4,2

的代码

相关问题