You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The general model language should not know about CSV. Checking where the concept actually leaks today:
package
lines mentioning CSV
editor-model
0
protocol-model
0
service-model
2, both prose in one doc comment
language-model
64
So the packages are clean apart from language-model, and there the mentions are not incidental. They are real CSV-specific logic:
modelGModelFactory.createCsvNodes, plus resolveCsvColumns, createCsvPropertyAssignments, formatCsvValue, a CSV_ID_COLUMN constant and a CsvColumnBinding type
modelMetadataManager.extractCsvNodeMetadata, keyed off a csv-node- id prefix
parseCsv imported from language-shared
The import block itself is already generic: the grammar resolves it through BaseModelImport and the contribution plugin mechanism, and since #23 the model service delegates the data computation to the plugin own service. Rendering is the part that never got the same treatment, so it reaches into the import structurally by wrapper type name and then parses CSV itself.
Why it happened
There is a generic extension point for grammar and for data computation, but none for the diagram. createCsvNodes works around that by matching on getWrapperInterfaceName("CSV") and reading the file directly. The doc comment on that method admits as much.
Rough shape of a fix
Give the diagram the same kind of extension point the other two have: a contribution plugin can supply the nodes for its own import block, and ModelGModelFactory composes whatever the active plugins return without knowing what any of them are. The CSV specifics then live in language-model-csv, next to the import logic they belong with.
Two things to settle:
Node identity and layout metadata. Positions are persisted per node id, and the current ids are csv-node-N, produced by the factory. A generic point needs the plugin to own stable ids without the host inventing a namespace per format.
How the plugin reads its source file. Today this goes through Langium FileSystemProvider, which @nk-coding suggested replacing with reading the already-loaded Langium document instead. That is a better fit, .csv is a registered language so the document exists, and it also answers the Copilot comment on CSV import: explicit column-to-property mapping #26 about EmptyFileSystemProvider in the backend services. Worth folding into the same change rather than doing separately.
Scope note
This predates #26, it came in with #23. @nk-coding said he would understand not going back for it now. Raising it so it is tracked rather than lost, and happy to take it either as a follow up or folded into #26, whichever you prefer.
Raised from @nk-coding review comments on #26.
The point
The general model language should not know about CSV. Checking where the concept actually leaks today:
editor-modelprotocol-modelservice-modellanguage-modelSo the packages are clean apart from
language-model, and there the mentions are not incidental. They are real CSV-specific logic:modelGModelFactory.createCsvNodes, plusresolveCsvColumns,createCsvPropertyAssignments,formatCsvValue, aCSV_ID_COLUMNconstant and aCsvColumnBindingtypemodelMetadataManager.extractCsvNodeMetadata, keyed off acsv-node-id prefixparseCsvimported fromlanguage-sharedThe import block itself is already generic: the grammar resolves it through
BaseModelImportand the contribution plugin mechanism, and since #23 the model service delegates the data computation to the plugin own service. Rendering is the part that never got the same treatment, so it reaches into the import structurally by wrapper type name and then parses CSV itself.Why it happened
There is a generic extension point for grammar and for data computation, but none for the diagram.
createCsvNodesworks around that by matching ongetWrapperInterfaceName("CSV")and reading the file directly. The doc comment on that method admits as much.Rough shape of a fix
Give the diagram the same kind of extension point the other two have: a contribution plugin can supply the nodes for its own import block, and
ModelGModelFactorycomposes whatever the active plugins return without knowing what any of them are. The CSV specifics then live inlanguage-model-csv, next to the import logic they belong with.Two things to settle:
csv-node-N, produced by the factory. A generic point needs the plugin to own stable ids without the host inventing a namespace per format.FileSystemProvider, which @nk-coding suggested replacing with reading the already-loaded Langium document instead. That is a better fit,.csvis a registered language so the document exists, and it also answers the Copilot comment on CSV import: explicit column-to-property mapping #26 aboutEmptyFileSystemProviderin the backend services. Worth folding into the same change rather than doing separately.Scope note
This predates #26, it came in with #23. @nk-coding said he would understand not going back for it now. Raising it so it is tracked rather than lost, and happy to take it either as a follow up or folded into #26, whichever you prefer.
@szschaler @nk-coding