rome / tools

Unified developer tools for JavaScript, TypeScript, and the web
https://docs.rome.tools/
MIT License
23.71k stars 660 forks source link

πŸ› The code output is badly formatted on VSCode from Git control source #4355

Closed PhiSyX closed 1 year ago

PhiSyX commented 1 year ago

Environment information

CLI:
  Version:                      12.0.0
  Color support:                true

Platform:
  CPU Architecture:             x86_64
  OS:                           windows

Environment:
  ROME_LOG_DIR:                 unset
  NO_COLOR:                     unset
  TERM:                         unset
  JS_RUNTIME_VERSION:           "v19.8.1"
  JS_RUNTIME_NAME:              "node"
  NODE_PACKAGE_MANAGER:         "null"

Rome Configuration:
  Status:                       Loaded successfully
  Formatter disabled:           false
  Linter disabled:              false
  Organize imports disabled:    false

Workspace:
  Open Documents:               0

Discovering running Rome servers...

Running Rome Server: ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

i The client isn't connected to any server but rage discovered this running Rome server.

Server:
  Version:                      12.0.0
  Name:                         rome_lsp
  CPU Architecture:             x86_64
  OS:                           windows

Workspace:
  Open Documents:               0

Other Active Server Workspaces:

Workspace:
  Open Documents:               1
  Client Name:                  Visual Studio Code
  Client Version:               1.77.1

Rome Server Log:

! Please review the content of the log file before sharing it publicly as it may contain sensitive information:
  * Path names that may reveal your name, a project name, or the name of your employer.
  * Source code

┐rome_cli::commands::daemon::Running Server{pid=20112}
β”œβ”€β”rome_lsp::server::initialize{root_uri=file:///c%3A/<path>/phisyRC, capabilities=ClientCapabilities { workspace: Some(WorkspaceClientCapabilities { apply_edit: Some(true), workspace_edit: Some(WorkspaceEditClientCapabilities { document_changes: Some(true), resource_operations: Some([Create, Rename, Delete]), failure_handling: Some(TextOnlyTransactional), normalizes_line_endings: Some(true), change_annotation_support: Some(ChangeAnnotationWorkspaceEditClientCapabilities { groups_on_label: Some(true) }) }), did_change_configuration: Some(DynamicRegistrationClientCapabilities { dynamic_registration: Some(true) }), did_change_watched_files: Some(DidChangeWatchedFilesClientCapabilities { dynamic_registration: Some(true), relative_pattern_support: Some(true) }), symbol: Some(WorkspaceSymbolClientCapabilities { dynamic_registration: Some(true), symbol_kind: Some(SymbolKindCapability { value_set: Some([File, Module, Namespace, Package, Class, Method, Property, Field, Constructor, Enum, Interface, Function, Variable, Constant, String, Number, Boolean, Array, Object, Key, Null, EnumMember, Struct, Event, Operator, TypeParameter]) }), tag_support: Some(TagSupport { value_set: [Deprecated] }), resolve_support: Some(WorkspaceSymbolResolveSupportCapability { properties: ["location.range"] }) }), execute_command: Some(DynamicRegistrationClientCapabilities { dynamic_registration: Some(true) }), workspace_folders: Some(true), configuration: Some(true), semantic_tokens: Some(SemanticTokensWorkspaceClientCapabilities { refresh_support: Some(true) }), code_lens: Some(CodeLensWorkspaceClientCapabilities { refresh_support: Some(true) }), file_operations: Some(WorkspaceFileOperationsClientCapabilities { dynamic_registration: Some(true), did_create: Some(true), will_create: Some(true), did_rename: Some(true), will_rename: Some(true), did_delete: Some(true), will_delete: Some(true) }), inline_value: Some(InlineValueWorkspaceClientCapabilities { refresh_support: Some(true) }), inlay_hint: Some(InlayHintWorkspaceClientCapabilities { refresh_support: Some(true) }) }), text_document: Some(TextDocumentClientCapabilities { synchronization: Some(TextDocumentSyncClientCapabilities { dynamic_registration: Some(true), will_save: Some(true), will_save_wait_until: Some(true), did_save: Some(true) }), completion: Some(CompletionClientCapabilities { dynamic_registration: Some(true), completion_item: Some(CompletionItemCapability { snippet_support: Some(true), commit_characters_support: Some(true), documentation_format: Some([Markdown, PlainText]), deprecated_support: Some(true), preselect_support: Some(true), tag_support: Some(TagSupport { value_set: [Deprecated] }), insert_replace_support: Some(true), resolve_support: Some(CompletionItemCapabilityResolveSupport { properties: ["documentation", "detail", "additionalTextEdits"] }), insert_text_mode_support: Some(InsertTextModeSupport { value_set: [AsIs, AdjustIndentation] }), label_details_support: Some(true) }), completion_item_kind: Some(CompletionItemKindCapability { value_set: Some([Text, Method, Function, Constructor, Field, Variable, Class, Interface, Module, Property, Unit, Value, Enum, Keyword, Snippet, Color, File, Reference, Folder, EnumMember, Constant, Struct, Event, Operator, TypeParameter]) }), context_support: Some(true), insert_text_mode: Some(AdjustIndentation), completion_list: Some(CompletionListCapability { item_defaults: Some(["commitCharacters", "editRange", "insertTextFormat", "insertTextMode"]) }) }), hover: Some(HoverClientCapabilities { dynamic_registration: Some(true), content_format: Some([Markdown, PlainText]) }), signature_help: Some(SignatureHelpClientCapabilities { dynamic_registration: Some(true), signature_information: Some(SignatureInformationSettings { documentation_format: Some([Markdown, PlainText]), parameter_information: Some(ParameterInformationSettings { label_offset_support: Some(true) }), active_parameter_support: Some(true) }), context_support: Some(true) }), references: Some(DynamicRegistrationClientCapabilities { dynamic_registration: Some(true) }), document_highlight: Some(DynamicRegistrationClientCapabilities { dynamic_registration: Some(true) }), document_symbol: Some(DocumentSymbolClientCapabilities { dynamic_registration: Some(true), symbol_kind: Some(SymbolKindCapability { value_set: Some([File, Module, Namespace, Package, Class, Method, Property, Field, Constructor, Enum, Interface, Function, Variable, Constant, String, Number, Boolean, Array, Object, Key, Null, EnumMember, Struct, Event, Operator, TypeParameter]) }), hierarchical_document_symbol_support: Some(true), tag_support: Some(TagSupport { value_set: [Deprecated] }) }), formatting: Some(DynamicRegistrationClientCapabilities { dynamic_registration: Some(true) }), range_formatting: Some(DynamicRegistrationClientCapabilities { dynamic_registration: Some(true) }), on_type_formatting: Some(DynamicRegistrationClientCapabilities { dynamic_registration: Some(true) }), declaration: Some(GotoCapability { dynamic_registration: Some(true), link_support: Some(true) }), definition: Some(GotoCapability { dynamic_registration: Some(true), link_support: Some(true) }), type_definition: Some(GotoCapability { dynamic_registration: Some(true), link_support: Some(true) }), implementation: Some(GotoCapability { dynamic_registration: Some(true), link_support: Some(true) }), code_action: Some(CodeActionClientCapabilities { dynamic_registration: Some(true), code_action_literal_support: Some(CodeActionLiteralSupport { code_action_kind: CodeActionKindLiteralSupport { value_set: ["", "quickfix", "refactor", "refactor.extract", "refactor.inline", "refactor.rewrite", "source", "source.organizeImports"] } }), is_preferred_support: Some(true), disabled_support: Some(true), data_support: Some(true), resolve_support: Some(CodeActionCapabilityResolveSupport { properties: ["edit"] }), honors_change_annotations: Some(false) }), code_lens: Some(DynamicRegistrationClientCapabilities { dynamic_registration: Some(true) }), document_link: Some(DocumentLinkClientCapabilities { dynamic_registration: Some(true), tooltip_support: Some(true) }), color_provider: Some(DynamicRegistrationClientCapabilities { dynamic_registration: Some(true) }), rename: Some(RenameClientCapabilities { dynamic_registration: Some(true), prepare_support: Some(true), prepare_support_default_behavior: Some(Identifier), honors_change_annotations: Some(true) }), publish_diagnostics: Some(PublishDiagnosticsClientCapabilities { related_information: Some(true), tag_support: Some(TagSupport { value_set: [Unnecessary, Deprecated] }), version_support: Some(false), code_description_support: Some(true), data_support: Some(true) }), folding_range: Some(FoldingRangeClientCapabilities { dynamic_registration: Some(true), range_limit: Some(5000), line_folding_only: Some(true), folding_range_kind: Some(FoldingRangeKindCapability { value_set: Some([Comment, Imports, Region]) }), folding_range: Some(FoldingRangeCapability { collapsed_text: Some(false) }) }), selection_range: Some(SelectionRangeClientCapabilities { dynamic_registration: Some(true) }), linked_editing_range: Some(DynamicRegistrationClientCapabilities { dynamic_registration: Some(true) }), call_hierarchy: Some(DynamicRegistrationClientCapabilities { dynamic_registration: Some(true) }), semantic_tokens: Some(SemanticTokensClientCapabilities { dynamic_registration: Some(true), requests: SemanticTokensClientCapabilitiesRequests { range: Some(true), full: Some(Delta { delta: Some(true) }) }, token_types: [SemanticTokenType("namespace"), SemanticTokenType("type"), SemanticTokenType("class"), SemanticTokenType("enum"), SemanticTokenType("interface"), SemanticTokenType("struct"), SemanticTokenType("typeParameter"), SemanticTokenType("parameter"), SemanticTokenType("variable"), SemanticTokenType("property"), SemanticTokenType("enumMember"), SemanticTokenType("event"), SemanticTokenType("function"), SemanticTokenType("method"), SemanticTokenType("macro"), SemanticTokenType("keyword"), SemanticTokenType("modifier"), SemanticTokenType("comment"), SemanticTokenType("string"), SemanticTokenType("number"), SemanticTokenType("regexp"), SemanticTokenType("operator"), SemanticTokenType("decorator")], token_modifiers: [SemanticTokenModifier("declaration"), SemanticTokenModifier("definition"), SemanticTokenModifier("readonly"), SemanticTokenModifier("static"), SemanticTokenModifier("deprecated"), SemanticTokenModifier("abstract"), SemanticTokenModifier("async"), SemanticTokenModifier("modification"), SemanticTokenModifier("documentation"), SemanticTokenModifier("defaultLibrary")], formats: [TokenFormat("relative")], overlapping_token_support: Some(false), multiline_token_support: Some(false), server_cancel_support: Some(true), augments_syntax_tokens: Some(true) }), moniker: None, type_hierarchy: Some(DynamicRegistrationClientCapabilities { dynamic_registration: Some(true) }), inline_value: Some(DynamicRegistrationClientCapabilities { dynamic_registration: Some(true) }), inlay_hint: Some(InlayHintClientCapabilities { dynamic_registration: Some(true), resolve_support: Some(InlayHintResolveClientCapabilities { properties: ["tooltip", "textEdits", "label.tooltip", "label.location", "label.command"] }) }) }), window: Some(WindowClientCapabilities { work_done_progress: Some(true), show_message: Some(ShowMessageRequestClientCapabilities { message_action_item: Some(MessageActionItemCapabilities { additional_properties_support: Some(true) }) }), show_document: Some(ShowDocumentClientCapabilities { support: true }) }), general: Some(GeneralClientCapabilities { regular_expressions: Some(RegularExpressionsClientCapabilities { engine: "ECMAScript", version: Some("ES2020") }), markdown: Some(MarkdownClientCapabilities { parser: "marked", version: Some("1.1.0"), allowed_tags: None }), stale_request_support: Some(StaleRequestSupportClientCapabilities { cancel: true, retry_on_content_modified: ["textDocument/semanticTokens/full", "textDocument/semanticTokens/range", "textDocument/semanticTokens/full/delta"] }), position_encodings: Some([PositionEncodingKind("utf-16")]) }), experimental: None }, client_info=ClientInfo { name: "Visual Studio Code", version: Some("1.77.1") }, root_path="c:\\<path>\\phisyRC", workspace_folders=[WorkspaceFolder { uri: Url { scheme: "file", cannot_be_a_base: false, username: "", password: None, host: None, port: None, path: "/c%3A/<path>/phisyRC", query: None, fragment: None }, name: "phisyRC" }]}
β”‚ β”œβ”€0ms INFO rome_lsp::server Starting Rome Language Server...
β”‚ β”œβ”€0ms WARN rome_lsp::server The Rome Server was initialized with the deprecated `root_path` parameter: this is not supported, use `root_uri` instead
β”‚ β”œβ”€0ms WARN rome_lsp::server The Rome Server was initialized with the `workspace_folders` parameter: this is unsupported at the moment, use `root_uri` instead
β”œβ”€β”˜
β”œβ”€β”rome_lsp::server::initialized{params=InitializedParams}
β”‚ β”œβ”€0ms INFO rome_lsp::server Attempting to load the configuration from 'rome.json' file
β”‚ β”œβ”€β”rome_lsp::session::load_extension_settings{}
β”‚ β”œβ”€β”rome_lsp::session::load_workspace_settings{}
β”‚ β”‚ β”œβ”€0ms INFO rome_service::configuration Attempting to read the configuration file from c:\<path>\phisyRC\rome.json
β”‚ β”‚ β”œβ”€β”rome_fs::fs::os::OsFileSystem::open_with_options{path="c:\\<path>\\phisyRC\\rome.json", options=OpenOptions { read: true, write: false, truncate: false, create: false, create_new: false }}
β”‚ β”‚ β”œβ”€β”˜
β”‚ β”‚ β”œβ”€β”rome_fs::fs::os::OsFile::read_to_string{}
β”‚ β”‚ β”œβ”€β”˜
β”‚ β”‚ β”œβ”€β”rome_json_parser::parse{}
β”‚ β”‚ β”œβ”€β”˜
β”‚ β”‚ β”œβ”€0ms WARN rome_lsp::session The deserialization of the configuration resulted in errors. Rome will its defaults where possible.
β”‚ β”‚ β”œβ”€0ms INFO rome_lsp::session Loaded workspace settings: Configuration {
β”‚ β”‚ β”‚     schema: Some(
β”‚ β”‚ β”‚         "\"./node_modules/rome/configuration_schema.json\"",
β”‚ β”‚ β”‚     ),
β”‚ β”‚ β”‚     files: Some(
β”‚ β”‚ β”‚         FilesConfiguration {
β”‚ β”‚ β”‚             max_size: None,
β”‚ β”‚ β”‚             ignore: Some(
β”‚ β”‚ β”‚                 {
β”‚ β”‚ β”‚                     ".cargo/*",
β”‚ β”‚ β”‚                     ".fleet/*",
β”‚ β”‚ β”‚                     ".idea/*",
β”‚ β”‚ β”‚                     ".vscode/*",
β”‚ β”‚ β”‚                     ".phisyrc/*",
β”‚ β”‚ β”‚                     "dist/*",
β”‚ β”‚ β”‚                     "dist-ssr/*",
β”‚ β”‚ β”‚                     "node_modules/*",
β”‚ β”‚ β”‚                     "target/*",
β”‚ β”‚ β”‚                     "coverage/*",
β”‚ β”‚ β”‚                     "*.lock",
β”‚ β”‚ β”‚                     "*wasm*",
β”‚ β”‚ β”‚                 },
β”‚ β”‚ β”‚             ),
β”‚ β”‚ β”‚         },
β”‚ β”‚ β”‚     ),
β”‚ β”‚ β”‚     formatter: Some(
β”‚ β”‚ β”‚         FormatterConfiguration {
β”‚ β”‚ β”‚             enabled: true,
β”‚ β”‚ β”‚             format_with_errors: false,
β”‚ β”‚ β”‚             indent_style: Tab,
β”‚ β”‚ β”‚             indent_size: 4,
β”‚ β”‚ β”‚             line_width: LineWidth(
β”‚ β”‚ β”‚                 80,
β”‚ β”‚ β”‚             ),
β”‚ β”‚ β”‚             ignore: None,
β”‚ β”‚ β”‚         },
β”‚ β”‚ β”‚     ),
β”‚ β”‚ β”‚     organize_imports: Some(
β”‚ β”‚ β”‚         OrganizeImports {
β”‚ β”‚ β”‚             enabled: true,
β”‚ β”‚ β”‚             ignore: None,
β”‚ β”‚ β”‚         },
β”‚ β”‚ β”‚     ),
β”‚ β”‚ β”‚     linter: Some(
β”‚ β”‚ β”‚         LinterConfiguration {
β”‚ β”‚ β”‚             enabled: true,
β”‚ β”‚ β”‚             rules: Some(
β”‚ β”‚ β”‚                 Rules {
β”‚ β”‚ β”‚                     recommended: Some(
β”‚ β”‚ β”‚                         true,
β”‚ β”‚ β”‚                     ),
β”‚ β”‚ β”‚                     all: None,
β”‚ β”‚ β”‚                     a11y: None,
β”‚ β”‚ β”‚                     complexity: None,
β”‚ β”‚ β”‚                     correctness: None,
β”‚ β”‚ β”‚                     nursery: None,
β”‚ β”‚ β”‚                     performance: None,
β”‚ β”‚ β”‚                     security: None,
β”‚ β”‚ β”‚                     style: Some(
β”‚ β”‚ β”‚                         Style {
β”‚ β”‚ β”‚                             recommended: Some(
β”‚ β”‚ β”‚                                 true,
β”‚ β”‚ β”‚                             ),
β”‚ β”‚ β”‚                             all: None,
β”‚ β”‚ β”‚                             no_arguments: None,
β”‚ β”‚ β”‚                             no_implicit_boolean: None,
β”‚ β”‚ β”‚                             no_negation_else: None,
β”‚ β”‚ β”‚                             no_non_null_assertion: Some(
β”‚ β”‚ β”‚                                 Plain(
β”‚ β”‚ β”‚                                     Off,
β”‚ β”‚ β”‚                                 ),
β”‚ β”‚ β”‚                             ),
β”‚ β”‚ β”‚                             no_shouty_constants: None,
β”‚ β”‚ β”‚                             no_unused_template_literal: None,
β”‚ β”‚ β”‚                             no_var: None,
β”‚ β”‚ β”‚                             use_block_statements: None,
β”‚ β”‚ β”‚                             use_const: Some(
β”‚ β”‚ β”‚                                 Plain(
β”‚ β”‚ β”‚                                     Off,
β”‚ β”‚ β”‚                                 ),
β”‚ β”‚ β”‚                             ),
β”‚ β”‚ β”‚                             use_default_parameter_last: None,
β”‚ β”‚ β”‚                             use_enum_initializers: None,
β”‚ β”‚ β”‚                             use_exponentiation_operator: None,
β”‚ β”‚ β”‚                             use_fragment_syntax: None,
β”‚ β”‚ β”‚                             use_numeric_literals: None,
β”‚ β”‚ β”‚                             use_self_closing_elements: None,
β”‚ β”‚ β”‚                             use_shorthand_array_type: None,
β”‚ β”‚ β”‚                             use_single_case_statement: None,
β”‚ β”‚ β”‚                             use_single_var_declarator: None,
β”‚ β”‚ β”‚                             use_template: None,
β”‚ β”‚ β”‚                             use_while: None,
β”‚ β”‚ β”‚                         },
β”‚ β”‚ β”‚                     ),
β”‚ β”‚ β”‚                     suspicious: Some(
β”‚ β”‚ β”‚                         Suspicious {
β”‚ β”‚ β”‚                             recommended: Some(
β”‚ β”‚ β”‚                                 true,
β”‚ β”‚ β”‚                             ),
β”‚ β”‚ β”‚                             all: None,
β”‚ β”‚ β”‚                             no_array_index_key: None,
β”‚ β”‚ β”‚                             no_async_promise_executor: None,
β”‚ β”‚ β”‚                             no_catch_assign: None,
β”‚ β”‚ β”‚                             no_comment_text: None,
β”‚ β”‚ β”‚                             no_compare_neg_zero: None,
β”‚ β”‚ β”‚                             no_const_enum: Some(
β”‚ β”‚ β”‚                                 Plain(
β”‚ β”‚ β”‚                                     Off,
β”‚ β”‚ β”‚                                 ),
β”‚ β”‚ β”‚                             ),
β”‚ β”‚ β”‚                             no_debugger: None,
β”‚ β”‚ β”‚                             no_double_equals: None,
β”‚ β”‚ β”‚                             no_duplicate_object_keys: None,
β”‚ β”‚ β”‚                             no_duplicate_parameters: None,
β”‚ β”‚ β”‚                             no_empty_interface: None,
β”‚ β”‚ β”‚                             no_explicit_any: None,
β”‚ β”‚ β”‚                             no_extra_non_null_assertion: None,
β”‚ β”‚ β”‚                             no_function_assign: None,
β”‚ β”‚ β”‚                             no_import_assign: None,
β”‚ β”‚ β”‚                             no_label_var: None,
β”‚ β”‚ β”‚                             no_redundant_use_strict: None,
β”‚ β”‚ β”‚                             no_shadow_restricted_names: None,
β”‚ β”‚ β”‚                             no_sparse_array: None,
β”‚ β”‚ β”‚                             no_unsafe_negation: None,
β”‚ β”‚ β”‚                             use_default_switch_clause_last: None,
β”‚ β”‚ β”‚                             use_valid_typeof: None,
β”‚ β”‚ β”‚                         },
β”‚ β”‚ β”‚                     ),
β”‚ β”‚ β”‚                 },
β”‚ β”‚ β”‚             ),
β”‚ β”‚ β”‚             ignore: None,
β”‚ β”‚ β”‚         },
β”‚ β”‚ β”‚     ),
β”‚ β”‚ β”‚     javascript: None,
β”‚ β”‚ β”‚ }
β”‚ β”‚ β”œβ”€β”rome_service::workspace::server::update_settings{params=UpdateSettingsParams { configuration: Configuration { schema: Some("\"./node_modules/rome/configuration_schema.json\""), files: Some(FilesConfiguration { max_size: None, ignore: Some({".cargo/*", ".fleet/*", ".idea/*", ".vscode/*", ".phisyrc/*", "dist/*", "dist-ssr/*", "node_modules/*", "target/*", "coverage/*", "*.lock", "*wasm*"}) }), formatter: Some(FormatterConfiguration { enabled: true, format_with_errors: false, indent_style: Tab, indent_size: 4, line_width: LineWidth(80), ignore: None }), organize_imports: Some(OrganizeImports { enabled: true, ignore: None }), linter: Some(LinterConfiguration { enabled: true, rules: Some(Rules { recommended: Some(true), all: None, a11y: None, complexity: None, correctness: None, nursery: None, performance: None, security: None, style: Some(Style { recommended: Some(true), all: None, no_arguments: None, no_implicit_boolean: None, no_negation_else: None, no_non_null_assertion: Some(Plain(Off)), no_shouty_constants: None, no_unused_template_literal: None, no_var: None, use_block_statements: None, use_const: Some(Plain(Off)), use_default_parameter_last: None, use_enum_initializers: None, use_exponentiation_operator: None, use_fragment_syntax: None, use_numeric_literals: None, use_self_closing_elements: None, use_shorthand_array_type: None, use_single_case_statement: None, use_single_var_declarator: None, use_template: None, use_while: None }), suspicious: Some(Suspicious { recommended: Some(true), all: None, no_array_index_key: None, no_async_promise_executor: None, no_catch_assign: None, no_comment_text: None, no_compare_neg_zero: None, no_const_enum: Some(Plain(Off)), no_debugger: None, no_double_equals: None, no_duplicate_object_keys: None, no_duplicate_parameters: None, no_empty_interface: None, no_explicit_any: None, no_extra_non_null_assertion: None, no_function_assign: None, no_import_assign: None, no_label_var: None, no_redundant_use_strict: None, no_shadow_restricted_names: None, no_sparse_array: None, no_unsafe_negation: None, use_default_switch_clause_last: None, use_valid_typeof: None }) }), ignore: None }), javascript: None } }}
β”‚ β”‚ β”‚ β”œβ”€β”rome_service::settings::merge_with_configuration{configuration=Configuration { schema: Some("\"./node_modules/rome/configuration_schema.json\""), files: Some(FilesConfiguration { max_size: None, ignore: Some({".cargo/*", ".fleet/*", ".idea/*", ".vscode/*", ".phisyrc/*", "dist/*", "dist-ssr/*", "node_modules/*", "target/*", "coverage/*", "*.lock", "*wasm*"}) }), formatter: Some(FormatterConfiguration { enabled: true, format_with_errors: false, indent_style: Tab, indent_size: 4, line_width: LineWidth(80), ignore: None }), organize_imports: Some(OrganizeImports { enabled: true, ignore: None }), linter: Some(LinterConfiguration { enabled: true, rules: Some(Rules { recommended: Some(true), all: None, a11y: None, complexity: None, correctness: None, nursery: None, performance: None, security: None, style: Some(Style { recommended: Some(true), all: None, no_arguments: None, no_implicit_boolean: None, no_negation_else: None, no_non_null_assertion: Some(Plain(Off)), no_shouty_constants: None, no_unused_template_literal: None, no_var: None, use_block_statements: None, use_const: Some(Plain(Off)), use_default_parameter_last: None, use_enum_initializers: None, use_exponentiation_operator: None, use_fragment_syntax: None, use_numeric_literals: None, use_self_closing_elements: None, use_shorthand_array_type: None, use_single_case_statement: None, use_single_var_declarator: None, use_template: None, use_while: None }), suspicious: Some(Suspicious { recommended: Some(true), all: None, no_array_index_key: None, no_async_promise_executor: None, no_catch_assign: None, no_comment_text: None, no_compare_neg_zero: None, no_const_enum: Some(Plain(Off)), no_debugger: None, no_double_equals: None, no_duplicate_object_keys: None, no_duplicate_parameters: None, no_empty_interface: None, no_explicit_any: None, no_extra_non_null_assertion: None, no_function_assign: None, no_import_assign: None, no_label_var: None, no_redundant_use_strict: None, no_shadow_restricted_names: None, no_sparse_array: None, no_unsafe_negation: None, use_default_switch_clause_last: None, use_valid_typeof: None }) }), ignore: None }), javascript: None }}
β”‚ β”‚ β”‚ β”œβ”€β”˜
β”‚ β”‚ β”œβ”€β”˜
β”‚ β”œβ”€β”˜
β”œβ”€β”rome_lsp::handlers::text_document::did_open{params=DidOpenTextDocumentParams { text_document: TextDocumentItem { uri: Url { scheme: "file", cannot_be_a_base: false, username: "", password: None, host: None, port: None, path: "/c%3A/<path>/phisyRC/test.ts", query: None, fragment: None }, language_id: "typescript", version: 5, text: "function foobar(platform: string[], root_dir: string, args: string) {\n\tlet target = root_dir + args.replace(root_dir, \"\");\n\tif (!platform.includes(\"win\")) {\n\t\ttarget = `/${target}`;\n\t}\n\treturn target;\n}return target;\n}\n" } }}
β”‚ β”œβ”€β”rome_lsp::session::update_diagnostics{url=file:///c%3A/<path>/phisyRC/test.ts}
β”‚ β”‚ β”œβ”€β”rome_js_parser::parse::parse{}
β”‚ β”‚ β”œβ”€β”˜
β”‚ β”œβ”€β”˜
β”œβ”€β”˜
β”‚ β”‚ β”œβ”€3ms INFO rome_lsp::session Loaded client configuration: Object {
β”‚ β”‚ β”‚     "lspBin": Null,
β”‚ β”‚ β”‚     "rename": Null,
β”‚ β”‚ β”‚     "requireConfiguration": Bool(false),
β”‚ β”‚ β”‚ }
β”‚ β”œβ”€β”˜
β”œβ”€β”rome_lsp::handlers::text_document::did_open{params=DidOpenTextDocumentParams { text_document: TextDocumentItem { uri: Url { scheme: "git", cannot_be_a_base: false, username: "", password: None, host: None, port: None, path: "/c%3A/<path>/phisyRC/test.ts", query: Some("%7B%22path%22%3A%22c%3A%5C%5%5C%5CphisyRC%5C%5Ctest.ts%22%2C%22ref%22%3A%22~%22%7D"), fragment: None }, language_id: "typescript", version: 1, text: "function foobar(platform: string[], root_dir: string, args: string) {\n\tlet target = root_dir + args.replace(root_dir, \"\");\n\tif (!platform.includes(\"win\")) {\n\t\ttarget = `/${target}`;\n\t}\n\treturn target;\n}\n" } }}
β”‚ β”œβ”€β”rome_lsp::session::update_diagnostics{url=git:/c%3A/<path>/phisyRC/test.ts?%7B%22path%22%3A%22c%3A%5C%5%5C%5CphisyRC%5C%5Ctest.ts%22%2C%22ref%22%3A%22~%22%7D}
β”‚ β”‚ β”œβ”€β”rome_js_parser::parse::parse{}
β”‚ β”‚ β”œβ”€β”˜
β”‚ β”œβ”€β”˜
β”œβ”€β”˜
β”‚ β”œβ”€5ms INFO rome_lsp::session Unregister capabilities "workspace/didChangeConfiguration, textDocument/formatting, textDocument/onTypeFormatting, textDocument/rangeFormatting, workspace/didChangeWatchedFiles, textDocument/rename"
β”‚ β”œβ”€6ms INFO rome_lsp::session Register capabilities "workspace/didChangeConfiguration, textDocument/formatting, textDocument/onTypeFormatting, textDocument/rangeFormatting, workspace/didChangeWatchedFiles"
β”‚ β”œβ”€β”rome_lsp::session::update_diagnostics{url=file:///c%3A/<path>/phisyRC/test.ts}
β”‚ β”œβ”€β”˜
β”‚ β”œβ”€β”rome_lsp::session::update_diagnostics{url=git:/c%3A/<path>/phisyRC/test.ts?%7B%22path%22%3A%22c%3A%5C%5%5C%5CphisyRC%5C%5Ctest.ts%22%2C%22ref%22%3A%22~%22%7D}
β”‚ β”œβ”€β”˜
β”œβ”€β”˜
β”œβ”€β”rome_lsp::handlers::analysis::code_actions{uri=file:///c%3A/<path>/phisyRC/test.ts, range=Range { start: Position { line: 0, character: 0 }, end: Position { line: 8, character: 0 } }, only=Some([CodeActionKind("source.organizeImports.rome")]), diagnostics=[Diagnostic { range: Range { start: Position { line: 7, character: 0 }, end: Position { line: 7, character: 1 } }, severity: Some(Error), code: Some(Number(1128)), code_description: None, source: Some("ts"), message: "Declaration or statement expected.", related_information: None, tags: None, data: None }]}
β”‚ β”œβ”€0ms DEBUG rome_rowan::ast::batch pushing change...
β”‚ β”œβ”€0ms DEBUG rome_rowan::ast::batch pushing change...
β”‚ β”œβ”€0ms DEBUG rome_rowan::ast::batch pushing change...
β”‚ β”œβ”€0ms DEBUG rome_rowan::ast::batch  changes [CommitChange { parent_depth: 11, parent: Some(JS_BINARY_EXPRESSION@84..121), parent_range: Some((84, 121)), new_node_slot: 0, new_node: Some(Node(JS_CALL_EXPRESSION@0..27)) }, CommitChange { parent_depth: 11, parent: Some(JS_BINARY_EXPRESSION@84..121), parent_range: Some((84, 121)), new_node_slot: 1, new_node: Some(Token(PLUS@0..2 "+" [] [Whitespace(" ")])) }, CommitChange { parent_depth: 11, parent: Some(JS_BINARY_EXPRESSION@84..121), parent_range: Some((84, 121)), new_node_slot: 2, new_node: Some(Node(JS_IDENTIFIER_EXPRESSION@0..8)) }]
β”‚ β”œβ”€0ms DEBUG rome_lsp::handlers::analysis Suggested actions: 
β”‚ β”‚ []
β”œβ”€β”˜
β”œβ”€β”rome_lsp::handlers::formatting::format_range{params=DocumentRangeFormattingParams { text_document: TextDocumentIdentifier { uri: Url { scheme: "file", cannot_be_a_base: false, username: "", password: None, host: None, port: None, path: "/c%3A/<path>/phisyRC/test.ts", query: None, fragment: None } }, range: Range { start: Position { line: 6, character: 0 }, end: Position { line: 6, character: 15 } }, options: FormattingOptions { tab_size: 4, insert_spaces: false, properties: {}, trim_trailing_whitespace: None, insert_final_newline: None, trim_final_newlines: None }, work_done_progress_params: WorkDoneProgressParams { work_done_token: None } }}
β”‚ β”œβ”€0ms ERROR rome_lsp::handlers::formatting error=formatting range 201..216 is larger than syntax tree 0..203
β”œβ”€β”˜
β”œβ”€2115ms ERROR rome_lsp::utils Error: formatting range 201..216 is larger than syntax tree 0..203
β”œβ”€2146ms WARN tower_lsp Got a textDocument/didSave notification, but it is not implemented
β”œβ”€β”rome_lsp::handlers::analysis::code_actions{uri=file:///c%3A/<path>/phisyRC/test.ts, range=Range { start: Position { line: 0, character: 0 }, end: Position { line: 0, character: 0 } }, only=None, diagnostics=[]}
β”‚ β”œβ”€0ms DEBUG rome_lsp::handlers::analysis Suggested actions: 
β”‚ β”‚ []
β”œβ”€β”˜
β”œβ”€β”rome_lsp::server::initialize{capabilities=ClientCapabilities { workspace: None, text_document: None, window: None, general: None, experimental: None }, client_info=ClientInfo { name: "rome_service", version: Some("12.0.0") }}
β”‚ β”œβ”€0ms INFO rome_lsp::server Starting Rome Language Server...
β”œβ”€β”˜
β”œβ”€β”rome_lsp::server::rome/rage{params=RageParams}
β”œβ”€β”˜
β”œβ”€β”rome_lsp::server::initialize{capabilities=ClientCapabilities { workspace: None, text_document: None, window: None, general: None, experimental: None }, client_info=ClientInfo { name: "rome_service", version: Some("12.0.0") }}
β”‚ β”œβ”€0ms INFO rome_lsp::server Starting Rome Language Server...
β”œβ”€β”˜
β”œβ”€β”rome_lsp::server::rome/rage{params=RageParams}
β”œβ”€β”˜

What happened?

When we save/format a modified file from the control source on VSCode, the output of the code generated by Rome is badly formatted nor causes an error.

  1. Open VSCode with a git project. With Rome extension version v0.22.0 (the latest one)

  2. Create a test.ts file with this piece of code

function foobar(platform: string[], root_dir: string, args: string) {
    let target = root_dir + args.replace(root_dir, "");
    if (!platform.includes("win")) {
        target = `/${target}`;
    }
    return target;
}
  1. Add the content of the file to the git index ( git add test.ts )

  2. Make changes to the code, for example:

const DS = "/";
function foobar(platform: string[], root_dir: string, args: string) {
    let target = root_dir + args.replace(root_dir, "");
    if (!platform.includes("win")) {
        target = DS + target;
    }
    return target;
}
  1. Save (Ctrl+S) the file

  2. Open this file from the VSCode git control source

  3. Save (Ctrl+S) the file from the VSCode git control source view. The output generated by Rome is :

    function foobar(platform: string[], root_dir: string, args: string) {
    let target = root_dir + args.replace(root_dir, "");
    if (!platform.includes("win")) {
        target = `/${target}`;
    }
    return target;
    }eturn target;
    }

Here is a video reproducing the problem, starting from step 4 :

https://user-images.githubusercontent.com/738010/230468439-4dac6704-ab07-448a-bebe-70338f6b5e54.mp4

Expected result

A correctly generated code, and should not cause any errors.

Code of Conduct

dayblox commented 1 year ago

Probably related to #4338, did not happen in v0.20.0

ematipico commented 1 year ago

Duplicate of https://github.com/rome/tools/issues/4136