-
Notifications
You must be signed in to change notification settings - Fork 12.5k
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
getOutliningSpans does not return multiline comment #22732
Comments
Hey @uniqueiniquity, looks like this is still in the TS 3.4 milestone along with a few other issues. Can you please review which milestone this should be in so it does not get lost |
Looking through this, there's quite a lot of support for outline spans in block comments - but basically they require some kind of JavaScript in the file in order to be registered. /// <reference path="fourslash.ts"/>
////[|/*
//// Block comment at the beginning of the file before module:
//// line one of the comment
//// line two of the comment
//// line three
//// line four
//// line five
////*/|]
////module Sayings[| {
//// [|/*
//// Comment before class:
//// line one of the comment
//// line two of the comment
//// line three
//// line four
//// line five
//// */|]
//// export class Greeter[| {
//// [|/*
//// Comment before a string identifier
//// line two of the comment
//// */|]
//// greeting: string;
//// [|/*
//// constructor
//// parameter message as a string
//// */|]
////
//// [|/*
//// Multiple comments should be collapsed individually
//// */|]
//// constructor(message: string /* do not collapse this */)[| {
//// this.greeting = message;
//// }|]
//// [|/*
//// method of a class
//// */|]
//// greet()[| {
//// return "Hello, " + this.greeting;
//// }|]
//// }|]
////}|]
////
////[|/*
//// Block comment for interface. The ending can be on the same line as the declaration.
////*/|]interface IFoo[| {
//// [|/*
//// Multiple block comments
//// */|]
////
//// [|/*
//// should be collapsed
//// */|]
////
//// [|/*
//// individually
//// */|]
////
//// [|/*
//// this comment has trailing space before /* and after *-/ signs
//// */|]
////
//// [|/**
//// *
//// *
//// *
//// */|]
////
//// [|/*
//// */|]
////
//// [|/*
//// */|]
//// // single line comments in the middle should not have an effect
//// [|/*
//// */|]
////
//// [|/*
//// */|]
////
//// [|/*
//// this block comment ends
//// on the same line */|] [|/* where the following comment starts
//// should be collapsed separately
//// */|]
////
//// getDist(): number;
////}|]
////
////var x =[|{
//// a:1,
//// b: 2,
//// [|/*
//// Over a function in an object literal
//// */|]
//// get foo()[| {
//// return 1;
//// }|]
////}|]
////
////// Over a function expression assigned to a variable
//// [|/**
//// * Return a sum
//// * @param {Number} y
//// * @param {Number} z
//// * @returns {Number} the sum of y and z
//// */|]
//// const sum2 = (y, z) =>[| {
//// return y + z;
//// }|];
verify.outliningSpansInCurrentFile(test.ranges()); It looks like the fix for the OP, and the test inside vscode this is basically to add an extra check for top-level comments which aren't attached to statements in the outliner. |
I don't get it, is it fixed or not? Can't fold comments in vscode still. |
Multiline comment folding is still inconsistent. Surely(?) the expected behavior is that all multiline comments are foldable/collapsible. This is what I'm seeing: Source: /*
Isolated multiline comment: COLLAPSIBLE
*/
/*
Multiline comment above class definition: COLLAPSIBLE
*/
class Foo {
/*
Multiline comment above a class member: COLLAPSIBLE
*/
bar = 1;
/*
Isolated multiline comment inside a class: NOT COLLAPSIBLE
*/
}
/*
Multiline comment above function definition: COLLAPSIBLE
*/
function foo() {
/*
Multiline comment inside a function: NOT COLLAPSIBLE
*/
const bar = 1;
return bar;
} Visual Studio Code: 1.49.2 |
TypeScript Version: 2.8.0-dev.20180320
From microsoft/vscode#45975
Search Terms:
Code
For the js:
Invoke
getOutliningSpans
on TS ServerExpected behavior:
Returns span that includes the multline comment
Actual behavior:
No outlining spans returned for the document
The text was updated successfully, but these errors were encountered: