Repository: parcel-bundler/parcel
File: packages/utils/parcel-lsp/src/LspServer.ts (TypeScript)

Code before:
  createMessageConnection,
  MessageConnection,
} from 'vscode-jsonrpc/node';
import * as invariant from 'assert';
import * as url from 'url';
import commonPathPrefix = require('common-path-prefix');

// import {TextDocument} from 'vscode-languageserver-textdocument';
import * as watcher from '@parcel/watcher';
import {
  NotificationBuild,
  NotificationBuildStatus,
  NotificationWorkspaceDiagnostics,
  RequestDocumentDiagnostics,
  RequestImporters,
} from '@parcel/lsp-protocol';

type Metafile = {
  projectRoot: string;
  pid: typeof process['pid'];
  argv: typeof process['argv'];
};

const connection = createConnection(ProposedFeatures.all);
const WORKSPACE_ROOT = process.cwd();

// Create a simple text document manager.
// const documents: TextDocuments<TextDocument> = new TextDocuments(TextDocument);

let hasConfigurationCapability = false;
let hasWorkspaceFolderCapability = false;
// let hasDiagnosticRelatedInformationCapability = false;
let hasDiagnosticsRefreshSupport = false;

connection.onInitialize((params: InitializeParams) => {
  const capabilities = params.capabilities;

  // Does the client support the `workspace/configuration` request?
  // If not, we fall back using global settings.
  hasConfigurationCapability = !!(
    capabilities.workspace && !!capabilities.workspace.configuration
  );
  hasWorkspaceFolderCapability = !!(
    capabilities.workspace && !!capabilities.workspace.workspaceFolders
  );
  // hasDiagnosticRelatedInformationCapability = !!(
  //   capabilities.textDocument &&
  //   capabilities.textDocument.publishDiagnostics &&
  //   capabilities.textDocument.publishDiagnostics.relatedInformation
  // );
  hasDiagnosticsRefreshSupport = Boolean(

Review comment (suggestion):
```suggestion
const LSP_SENTINEL_FILENAME = 'lsp-server';
```

Code after:
  createMessageConnection,
  MessageConnection,
} from 'vscode-jsonrpc/node';
import * as invariant from 'assert';
import * as url from 'url';
import commonPathPrefix = require('common-path-prefix');

// import {TextDocument} from 'vscode-languageserver-textdocument';
import * as watcher from '@parcel/watcher';
import {
  NotificationBuild,
  NotificationBuildStatus,
  NotificationWorkspaceDiagnostics,
  RequestDocumentDiagnostics,
  RequestImporters,
} from '@parcel/lsp-protocol';

type Metafile = {
  projectRoot: string;
  pid: typeof process['pid'];
  argv: typeof process['argv'];
};

const connection = createConnection(ProposedFeatures.all);
const WORKSPACE_ROOT = process.cwd();
const LSP_SENTINEL_FILENAME = 'lsp-server';
// Create a simple text document manager.
// const documents: TextDocuments<TextDocument> = new TextDocuments(TextDocument);

let hasConfigurationCapability = false;
let hasWorkspaceFolderCapability = false;
// let hasDiagnosticRelatedInformationCapability = false;
let hasDiagnosticsRefreshSupport = false;

connection.onInitialize((params: InitializeParams) => {
  const capabilities = params.capabilities;

  // Does the client support the `workspace/configuration` request?
  // If not, we fall back using global settings.
  hasConfigurationCapability = !!(
    capabilities.workspace && !!capabilities.workspace.configuration
  );
  hasWorkspaceFolderCapability = !!(
    capabilities.workspace && !!capabilities.workspace.workspaceFolders
  );
  // hasDiagnosticRelatedInformationCapability = !!(
  //   capabilities.textDocument &&
  //   capabilities.textDocument.publishDiagnostics &&
  //   capabilities.textDocument.publishDiagnostics.relatedInformation
  // );
  hasDiagnosticsRefreshSupport = Boolean(