documentation icon indicating copy to clipboard operation
documentation copied to clipboard

[ Bug report ] TypeScript / JavaScript whitespace

Open rachfop opened this issue 3 years ago • 1 comments

Required

What is the issue? When switching between TypeScript/JavaScript code samples, I've noticed that TypeScript uses 4 spaces , whereas JavaScript only uses 2 spaces . How can we reproduce the issue?

For example, on this page.

TypeScript

const handle = await client.start(example, {
    taskQueue: 'search-attributes',
    workflowId: 'search-attributes-example-0',
    searchAttributes: {
      CustomIntField: [2],
      CustomKeywordField: ['keywordA', 'keywordB'],
      CustomBoolField: [true],
      CustomDatetimeField: [new Date()],
      CustomStringField: [
        'String field is for text. When queried, it will be tokenized for partial match. StringTypeField cannot be used in Order By',
      ],
    },
  });

  const { searchAttributes } = await handle.describe();

JavaScript

const handle = await client.start(example, {
  taskQueue: 'search-attributes',
  workflowId: 'search-attributes-example-0',
  searchAttributes: {
    CustomIntField: [2],
    CustomKeywordField: ['keywordA', 'keywordB'],
    CustomBoolField: [true],
    CustomDatetimeField: [new Date()],
    CustomStringField: [
      'String field is for text. When queried, it will be tokenized for partial match. StringTypeField cannot be used in Order By',
    ],
  },
});

const { searchAttributes } = await handle.describe();

Because of that, it appears that TypeScript isn't hightlighting the "keys" or var names and JavaScript does.

What is the expected behavior?

Additional context (optional—the more we know, the faster it goes)

Screenshots:

TypeScript

Screen Shot 2022-08-24 at 8 23 15 AM

JavaScript

Screen Shot 2022-08-24 at 8 23 22 AM

rachfop avatar Aug 24 '22 15:08 rachfop

It's due to the snippet comment not starting indented:

image

@vkarpov15 are you up for looking at removing the indentation? Related: #1379

lorensr avatar Aug 24 '22 15:08 lorensr