-
-
Notifications
You must be signed in to change notification settings - Fork 391
Closed
Description
How are you using the lua-language-server?
Visual Studio Code Extension (sumneko.lua)
Which OS are you using?
MacOS
What is the issue affecting?
Formatting
Expected Behaviour
The issue manifests in the first two lines and the last table assignment, the rest is for context.
local product_to_recipe_map = require("utility.product_to_recipe_map")
local events = require("utility.events")
---Represents the self refreshing cache for production statistics.
---@class ProductionStatisticsCache
---@field production_statistics ProductionStatistics The production statistics for all forces.
---@field on_production_statistics_refreshed fun(subscriber: fun()) Registers a subscriber to be notified when the production statistics have been refreshed.
---Represents the production statistics for all forces.
---@alias ProductionStatistics Dictionary<ForceName, ForceProductionStatistics>
---Represents the production statistics for a specific force.
---@class ForceProductionStatistics
---@field items Dictionary<ItemName, number> The item production statistics for a specific force.
---@field fluids Dictionary<FluidName, number> The fluid production statistics for a specific force.
---List of subscribers to notify when production statistics have been refreshed
---@type Array<fun()>
local production_statistics_refreshed_subscribers = {}
---@type ProductionStatisticsCache
local production_statistics_cache = {
production_statistics = {},
on_production_statistics_refreshed = function(subscriber)
table.insert(production_statistics_refreshed_subscribers, subscriber)
end
}Actual Behaviour
local product_to_recipe_map = require("utility.product_to_recipe_map")
local events = require("utility.events")
---Represents the self refreshing cache for production statistics.
---@class ProductionStatisticsCache
---@field production_statistics ProductionStatistics The production statistics for all forces.
---@field on_production_statistics_refreshed fun(subscriber: fun()) Registers a subscriber to be notified when the production statistics have been refreshed.
---Represents the production statistics for all forces.
---@alias ProductionStatistics Dictionary<ForceName, ForceProductionStatistics>
---Represents the production statistics for a specific force.
---@class ForceProductionStatistics
---@field items Dictionary<ItemName, number> The item production statistics for a specific force.
---@field fluids Dictionary<FluidName, number> The fluid production statistics for a specific force.
---List of subscribers to notify when production statistics have been refreshed
---@type Array<fun()>
local production_statistics_refreshed_subscribers = {}
---@type ProductionStatisticsCache
local production_statistics_cache = {
production_statistics = {},
on_production_statistics_refreshed = function(subscriber)
table.insert(production_statistics_refreshed_subscribers, subscriber)
end
}Reproduction steps
- Insert the code above into a new file
- Format the file
Additional Notes
Current version: v3.13.4
When inserting two empty lines in between the assignments, as suggested in #2069 , I get the expected result.
In that issue, the two assignment blocks were close to each other though, in my case, they are separated by a lot of comments.
Also, personally, I think even a single empty line should be enough to split the blocks, or alternatively comments should count as empty lines. Ideally, it would be configurable in the .editorconfig.
Log File
No response
Metadata
Metadata
Assignees
Labels
No labels