Skip to content

Fix ServerSpec | undefined type safety and wire up TS project references - #414

Merged
isc-klu merged 22 commits into
intersystems:masterfrom
isc-klu:fix/server-spec-undefined-type
Aug 25, 2026
Merged

isc-klu merged 22 commits into
intersystems:masterfrom
isc-klu:fix/server-spec-undefined-type

Conversation

@isc-klu

@isc-klu isc-klu commented Aug 21, 2026 •

Copy link
Copy Markdown
Collaborator

This fixes #413.

getServerSpec() could return undefined at runtime, but was typed as always returning ServerSpec, silently masking unresolved-server crashes at every call site. This PR fixes the types, adds guards, and wires up TS project references so common's types are enforced across client/server.

- Fix getServerSpec and ProtocolMethods resolveFromUri to return ServerSpec | undefined
- Add guards at all getServerSpec call sites across providers
- Fix resolveServerSpec in client to avoid non-null assertion
- Add TS project references for common from client/server/root
- Update clean script to remove tsbuildinfo files
- Rename deprecated typescript.* settings to js/ts.*
@isc-klu
isc-klu marked this pull request as ready for review August 21, 2026 16:28
@isc-klu
isc-klu requested a review from isc-bsaviano as a code owner August 21, 2026 16:28
Comment thread client/src/extension.ts Resolved
Comment thread .vscode/settings.json Resolved
Comment thread server/src/providers/diagnostic.ts Resolved
Comment thread server/src/providers/hover.ts Resolved
Comment thread client/src/extension.ts Resolved
Comment thread server/src/providers/completion.ts Resolved
Comment thread server/src/providers/diagnostic.ts Resolved
@isc-klu
isc-klu requested a review from isc-bsaviano August 21, 2026 20:42
@isc-klu isc-klu self-assigned this Aug 21, 2026
Comment thread server/src/providers/diagnostic.ts Resolved
@isc-klu
isc-klu requested a review from isc-bsaviano August 24, 2026 14:25
@isc-bsaviano

Copy link
Copy Markdown
Collaborator

I downloaded the latest dev VSIX for this PR but am still seeing the issue:

[Error - 8:37:18 AM] Request textDocument/diagnostic failed.
  Message: Request textDocument/diagnostic failed with message: Cannot read properties of undefined (reading 'toUpperCase')
  Code: -32603 
[Error - 8:37:18 AM] Document pull failed for text document file:///Users/bsaviano/Perforce/iris/latest/databases/enslib/cls/Ens/Rule/UI/RuleDocument.cls
  Message: Request textDocument/diagnostic failed with message: Cannot read properties of undefined (reading 'toUpperCase')
  Code: -32603

Comment thread client/src/extension.ts Resolved
@isc-klu
isc-klu requested a review from isc-bsaviano August 25, 2026 20:15

@isc-bsaviano isc-bsaviano left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Confirmed this worked with linked main extension PR

@isc-klu
isc-klu merged commit f9eb765 into intersystems:master Aug 25, 2026
11 checks passed
@isc-klu
isc-klu deleted the fix/server-spec-undefined-type branch August 26, 2026 01:36
ricxJr added a commit to consistem/language-server that referenced this pull request Sep 15, 2026
…ção no Marketplace (#16)

* Fixes intersystems#395

* Fixes intersystems#396, Prepare 2.8.3 release

* auto bump version with release [skip ci]

* Update Actions

* Create CONTRIBUTING.md

* Add ESLint (intersystems#399)

* Improve build configuration and add Prettier formatting (intersystems#401)

* Extend "Go to Definition" to cover class member definitions. (intersystems#405)

* Add issue templates and update CI

* Fix intersystems#406: Prevent multiple server sessions at startup (intersystems#408)

* Fixes intersystems#391

* OAuth2 Support (intersystems#407)

* Fix incompatibilities with pre-OAuth2 version of Server Manager (intersystems#409)

* Prepare 2.8.4 release

* auto bump version with release [skip ci]

* Fix hover intellisense for macros (intersystems#410)

* Fix AxiosError on activation (intersystems#412)

* Fix `ServerSpec | undefined` type safety and wire up TS project references (intersystems#414)

* Fix folding range failure when there's blank lines in between the open curly brace for a method or class and the definition line (intersystems#417)

* Activate faster when there are many workspace servers (intersystems#416)

* Prepare 2.8.5 release (intersystems#418)

* Bump version [skip ci]

* Fix ServerSpec cache returning the wrong namespace (intersystems#420)

* save

* Keep one ServerSpec cache entry per connection, not per namespace

Auth/cookies are namespace-independent, so fragmenting the cache by
namespace (as the previous fix did) loses intersystems#416's session-dedup benefit
for the common single-server multi-namespace case. Instead, cache one
entry per (username, host, port, pathPrefix) as before intersystems#420, and
override the returned namespace to match the current call's rather than
whatever was cached first.

* draft

* Don't match on serverName when looking up a cached connection

Two named servers can point at the same physical server; only the
password-change handler should filter by serverName.

* Match cached connections on connection fields only; serverName is its own special case

list() ignores serverName entirely (two named servers can point at the
same physical server), so callers can pass a whole ServerSpec without
over-matching. Deleting by serverName -- only needed on password change
-- gets a dedicated method instead.

* Treat an empty username as unresolved in the connection cache lookup

An unresolved BasicAuthorization reports username "", which used to
fall through to "match any known connection to this address" (intersystems#416) but
was being filtered as a literal "" and always missing. Also drop
values() in favor of list({}).

* Guard definition REST results against error responses without a result (intersystems#422)

Fixes intersystems#421. Three sites in definition.ts dereferenced
respdata.data.result.content after only checking respdata !== undefined;
4xx bodies passed through by makeRESTRequest have no result, so this
threw. Guard them the same way the rest of the file already does.

* chore(ci): remover publicação no Marketplace e Open VSX

O fork não tem mais acesso ao VS Code Marketplace nem ao Open VSX, então os
passos que publicavam o VSIX para esses registries só falhariam (ou seriam
pulados silenciosamente por falta de token).

- Removidos os passos `Publish to VS Code Marketplace` e `Publish to Open VSX
  Registry` do job `publish`, junto com o setup do Node e a instalação global
  do vsce, que só existiam para eles.
- Removida a devDependency `ovsx`, sem uso após a remoção.

O build dos 8 targets, o release beta a cada push no master e o anexo dos
.vsix nas releases continuam funcionando — é por aí que o VSIX segue
disponível para instalação interna.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Brett Saviano <bsaviano@intersystems.com>
Co-authored-by: ProjectBot <bot@users.noreply.github.com>
Co-authored-by: Kuang-Chen (KC) Lu <klu@intersystems.com>
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
ricxJr added a commit to consistem/language-server that referenced this pull request Nov 13, 2026
…#18)

* Fixes intersystems#395

* Fixes intersystems#396, Prepare 2.8.3 release

* auto bump version with release [skip ci]

* Update Actions

* Create CONTRIBUTING.md

* Add ESLint (intersystems#399)

* Improve build configuration and add Prettier formatting (intersystems#401)

* Extend "Go to Definition" to cover class member definitions. (intersystems#405)

* Add issue templates and update CI

* Fix intersystems#406: Prevent multiple server sessions at startup (intersystems#408)

* Fixes intersystems#391

* OAuth2 Support (intersystems#407)

* Fix incompatibilities with pre-OAuth2 version of Server Manager (intersystems#409)

* Prepare 2.8.4 release

* auto bump version with release [skip ci]

* Fix hover intellisense for macros (intersystems#410)

* Fix AxiosError on activation (intersystems#412)

* Fix `ServerSpec | undefined` type safety and wire up TS project references (intersystems#414)

* Fix folding range failure when there's blank lines in between the open curly brace for a method or class and the definition line (intersystems#417)

* Activate faster when there are many workspace servers (intersystems#416)

* Prepare 2.8.5 release (intersystems#418)

* Bump version [skip ci]

* Fix ServerSpec cache returning the wrong namespace (intersystems#420)

* save

* Keep one ServerSpec cache entry per connection, not per namespace

Auth/cookies are namespace-independent, so fragmenting the cache by
namespace (as the previous fix did) loses intersystems#416's session-dedup benefit
for the common single-server multi-namespace case. Instead, cache one
entry per (username, host, port, pathPrefix) as before intersystems#420, and
override the returned namespace to match the current call's rather than
whatever was cached first.

* draft

* Don't match on serverName when looking up a cached connection

Two named servers can point at the same physical server; only the
password-change handler should filter by serverName.

* Match cached connections on connection fields only; serverName is its own special case

list() ignores serverName entirely (two named servers can point at the
same physical server), so callers can pass a whole ServerSpec without
over-matching. Deleting by serverName -- only needed on password change
-- gets a dedicated method instead.

* Treat an empty username as unresolved in the connection cache lookup

An unresolved BasicAuthorization reports username "", which used to
fall through to "match any known connection to this address" (intersystems#416) but
was being filtered as a literal "" and always missing. Also drop
values() in favor of list({}).

* Guard definition REST results against error responses without a result (intersystems#422)

Fixes intersystems#421. Three sites in definition.ts dereferenced
respdata.data.result.content after only checking respdata !== undefined;
4xx bodies passed through by makeRESTRequest have no result, so this
threw. Guard them the same way the rest of the file already does.

* Prepare 2.8.6 release (intersystems#423)

* auto bump version with release [skip ci]

* Upgrade to TypeScript 6 (intersystems#425)

* Support UnknownUser via server manager 3.15.0-beta.3 (intersystems#426)

Upgrade @intersystems-community/intersystems-servermanager to 3.15.0-beta.3
and import its BasicAuthorization in place of the local copy. The
password-prompt guard now uses auth.resolved(), which handles UnknownUser
and empty passwords.

* Add completion for variables in method bodies (intersystems#427)

* Prepare 2.8.7 release (intersystems#428)

* auto bump version with release [skip ci]

* Keep server credentials out of the messages exchanged with the language server (intersystems#430)

* fix(sync): alinhar ao Server Manager 3.16 e remover compat com 3.14.x

O consistem-servermanager está sendo atualizado para a 3.16.0, cuja
BasicAuthorization já trata UnknownUser em resolved(), e a
consistem-vscode-objectscript 3.8.5 já exige essa API (^3.16.0). Com as
três extensões na mesma linha, a checagem extra de UnknownUser no guard
de senha deixa de ser necessária: o trecho volta a ser idêntico ao
upstream.

O vendor client/vendor/consistem-servermanager passa a se declarar
3.16.0, versão de que é cópia (API idêntica ao pacote 3.16.0 do upstream,
exceto pelo EXTENSION_ID).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Brett Saviano <bsaviano@intersystems.com>
Co-authored-by: ProjectBot <bot@users.noreply.github.com>
Co-authored-by: Kuang-Chen (KC) Lu <klu@intersystems.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Diagnositics fail when running on a document that has no server connection

2 participants