Skip to content

Commit 2df27a3

Browse files
committed
fix: remove nodejs file counting workaround
Removes the nodejs provider workaround that set Location to empty string to avoid duplicate file counting. This workaround is no longer needed as the root cause has been fixed in analyzer-lsp#1036. Changes: - Remove nodejs-specific Location="" workaround - Simplify provider configuration logic - Update comments to reference merged fix Fixes: konveyor/analyzer-lsp#1035 Related: konveyor/analyzer-lsp#1036 Signed-off-by: tsanders <[email protected]>
1 parent 1fe09da commit 2df27a3

File tree

1 file changed

+7
-16
lines changed

1 file changed

+7
-16
lines changed

cmd/analyze-hybrid.go

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -235,24 +235,22 @@ func (a *analyzeCommand) setupNetworkProvider(ctx context.Context, providerName
235235
case util.GoProvider:
236236
providerSpecificConfig["lspServerName"] = "generic"
237237
providerSpecificConfig[provider.LspServerPathConfigKey] = "/usr/local/bin/gopls"
238-
// Don't set workspaceFolders here - the generic Init method will set it from Location
239-
// to avoid duplicate paths in GetDocumentUris (which would count files twice)
238+
// Note: Don't set workspaceFolders - the generic Init method will use Location
239+
// Setting both would cause duplicate file counting in GetDocumentUris
240240
providerSpecificConfig["dependencyProviderPath"] = "/usr/local/bin/golang-dependency-provider"
241241

242242
case util.PythonProvider:
243243
providerSpecificConfig["lspServerName"] = "generic"
244244
providerSpecificConfig[provider.LspServerPathConfigKey] = "/usr/local/bin/pylsp"
245-
// Don't set workspaceFolders here - the generic Init method will set it from Location
246-
// to avoid duplicate paths in GetDocumentUris (which would count files twice)
245+
// Note: Don't set workspaceFolders - the generic Init method will use Location
246+
// Setting both would cause duplicate file counting in GetDocumentUris
247247

248248
case util.NodeJSProvider:
249249
providerSpecificConfig["lspServerName"] = "nodejs"
250250
providerSpecificConfig[provider.LspServerPathConfigKey] = "/usr/local/bin/typescript-language-server"
251251
providerSpecificConfig["lspServerArgs"] = []interface{}{"--stdio"}
252-
// WORKAROUND for analyzer-lsp#1035: Set workspaceFolders in config to avoid duplicate counting
253-
// GetDocumentUris uses BOTH Location and workspaceFolders, so we set workspaceFolders
254-
// and leave Location empty (will be set to "" below after switch statement)
255-
// See: https://github.com/konveyor/analyzer-lsp/issues/1035
252+
// Set workspaceFolders for nodejs provider (used alongside Location)
253+
// Fix merged in analyzer-lsp#1036 prevents duplicate file counting
256254
providerSpecificConfig["workspaceFolders"] = []interface{}{fmt.Sprintf("file://%s", util.SourceMountPath)}
257255

258256
case util.DotnetProvider:
@@ -273,20 +271,13 @@ func (a *analyzeCommand) setupNetworkProvider(ctx context.Context, providerName
273271
}
274272
}
275273

276-
// WORKAROUND: For nodejs, leave Location empty to prevent duplicate file counting
277-
// GetDocumentUris bug counts files twice when both Location and workspaceFolders are set
278-
location := util.SourceMountPath
279-
if providerName == util.NodeJSProvider {
280-
location = "" // workspaceFolders is already set in providerSpecificConfig above
281-
}
282-
283274
providerConfig := provider.Config{
284275
Name: providerName,
285276
Address: fmt.Sprintf("localhost:%d", provInit.port), // Connect to containerized provider
286277
BinaryPath: "", // Empty = network mode
287278
InitConfig: []provider.InitConfig{
288279
{
289-
Location: location,
280+
Location: util.SourceMountPath,
290281
AnalysisMode: provider.AnalysisMode(a.mode),
291282
ProviderSpecificConfig: providerSpecificConfig,
292283
Proxy: proxyConfig, // Keep as pointer - InitConfig.Proxy is *Proxy!

0 commit comments

Comments
 (0)