WebStorm TypeScript装饰器新行

时间:2018-08-03 09:57:52

标签: typescript webstorm decorator

我正在使用WebStorm IDE(JetBrains的2017.1.3)和TypeScript(.ts)文件以及更改和重新格式化我的装饰器。

library(shiny)
library(colourpicker)
library(networkD3)

ui <- fluidPage(
  colourInput('col', 'Select colour', 'purple'),
  actionButton(inputId = 'OK', label = 'enter color'),
  textOutput('couleurs'),
  actionButton(inputId = 'plot', label = 'plot'),
  sankeyNetworkOutput("splot")
)

server <- function(input, output) {
  values <- reactiveValues(col_string = '')

  observeEvent(input$OK, {
    if (values$col_string == '') {
      values$col_string <- paste0('"', input$col, '"')
    } else {
      values$col_string <- paste0(values$col_string, ', ', paste0('"', input$col, '"'))
    }
  })

  output$couleurs <- renderText({ values$col_string })

  observeEvent(input$plot, {
    if (values$col_string != '') {
      output$splot <- renderSankeyNetwork({
        data <- data.frame(i = c(0, 0, 0),
                           j = c(1, 2, 3),
                           value = c(3, 1, 2),
                           lgroup = c("lgroup1", "lgroup2", "lgroup2"))

        label <- data.frame(name = c("zero", "one", "two", "three"),
                            ngroup = c("ngroup1", "ngroup2", "ngroup2", "ngroup2"))

        domain <- paste0("'", paste(unique(c(as.character(data$lgroup), as.character(label$ngroup))), collapse = "', '"), "'")

        colorJS <-
          paste0('d3.scaleOrdinal().domain([', domain, ']).range([', values$col_string, '])')

        sankeyNetwork(Links = data, Nodes = label, Source = 'i', Target = 'j',
                      Value = 'value', NodeID = "name", NodeGroup = "ngroup",
                      LinkGroup = "lgroup", colourScale = colorJS)
      })
    }
  })
}

shinyApp(ui = ui, server = server)

他重新格式化为:

@Input() str: string;

而且我无法在设置的任何位置找到它,所以我希望将其保持在一行上。如何/在何处更改此设置?

屏幕截图:

My current IDE settings (screenshot)

1 个答案:

答案 0 :(得分:2)

请更新您的IDE。从 2017.3 开始should leave decorators as is(不强制使用任何样式)。最新版本为 2018.2 (上周发布)。

要真正强迫使用首选样式,请观看https://youtrack.jetbrains.com/issue/WEB-21121票证(星号/投票/评论)以获取有关任何进度的通知。