mirror of
https://github.com/SigNoz/signoz.git
synced 2026-08-06 21:20:42 +01:00
Compare commits
3 Commits
issue_5602
...
fix/error-
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
06d69afc05 | ||
|
|
84eeacd084 | ||
|
|
41576954c4 |
1
frontend/src/assets/Logos/auth0.svg
Normal file
1
frontend/src/assets/Logos/auth0.svg
Normal file
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path fill="#EB5424" d="M21.98 7.448 19.62 0H4.347L2.02 7.448c-1.352 4.312.03 9.206 3.815 12.015L12.007 24l6.157-4.552c3.755-2.81 5.182-7.688 3.815-12.015l-6.16 4.58 2.343 7.45-6.157-4.597-6.158 4.58 2.358-7.433-6.188-4.55 7.63-.045L12.008 0l2.356 7.404 7.615.044z"/></svg>
|
||||
|
After Width: | Height: | Size: 333 B |
1
frontend/src/assets/Logos/cohere.svg
Normal file
1
frontend/src/assets/Logos/cohere.svg
Normal file
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path fill="#355146" fill-rule="evenodd" d="M6.82 11.908c.525 0 1.57-.03 3.013-.639 1.682-.71 5.029-2 7.443-3.323 1.689-.926 2.429-2.151 2.429-3.8 0-2.29-1.81-4.146-4.043-4.146H6.307C3.1 0 .5 2.666.5 5.954s2.434 5.954 6.32 5.954" clip-rule="evenodd"/><path fill="#d18ee2" fill-rule="evenodd" d="M8.402 16.01c0-1.611.947-3.064 2.399-3.682l2.946-1.254c2.98-1.268 6.26.977 6.26 4.286 0 2.563-2.027 4.64-4.527 4.64l-3.19-.002c-2.147 0-3.888-1.785-3.888-3.987" clip-rule="evenodd"/><path fill="#ff7759" d="M3.848 12.691C1.998 12.691.5 14.228.5 16.124v.444C.5 18.464 1.999 20 3.848 20s3.347-1.536 3.347-3.432v-.444c0-1.896-1.499-3.433-3.347-3.433"/></svg>
|
||||
|
After Width: | Height: | Size: 709 B |
1
frontend/src/assets/Logos/hcp-vault.svg
Normal file
1
frontend/src/assets/Logos/hcp-vault.svg
Normal file
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path fill="#FFEC6E" d="m0 0 11.955 24L24 0zm13.366 4.827h1.393v1.38h-1.393zm-2.77 5.569H9.22V8.993h1.389zm0-2.087H9.22V6.906h1.389zm0-2.086H9.22V4.819h1.389zm2.087 6.263h-1.377V11.08h1.388zm0-2.09h-1.377V8.993h1.388zm0-2.087h-1.377V6.906h1.388zm0-2.086h-1.377V4.819h1.388zm.683.683h1.393v1.389h-1.393zm0 3.475V8.993h1.389v1.388Z"/></svg>
|
||||
|
After Width: | Height: | Size: 398 B |
1
frontend/src/assets/Logos/langflow.svg
Normal file
1
frontend/src/assets/Logos/langflow.svg
Normal file
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path fill="#9CA3AF" d="M9.755 1.52h-.001c-.31 0-.608.124-.828.343L4.037 6.752a1.17 1.17 0 0 1-.827.343H1.17A1.17 1.17 0 0 0 0 8.295l.052 1.984a1.17 1.17 0 0 0 1.17 1.14h2.37c.31 0 .607-.124.827-.344l4.93-4.93c.22-.22.517-.343.827-.343h2.874a1.17 1.17 0 0 0 1.17-1.17V2.69a1.17 1.17 0 0 0-1.17-1.17zm9.78 2.503c-.31 0-.608.123-.828.343l-4.889 4.889a1.17 1.17 0 0 1-.827.342h-2.756c-.31 0-.608.124-.827.344L4.15 15.197a1.17 1.17 0 0 1-.827.343H1.32a1.17 1.17 0 0 0-1.17 1.17v1.996c0 .646.524 1.17 1.17 1.17h2.017c.302 0 .592-.116.81-.325l5.535-5.304a1.17 1.17 0 0 1 .81-.326h2.88c.31 0 .607-.123.827-.342l4.93-4.93c.22-.22.517-.344.827-.344h2.873A1.17 1.17 0 0 0 24 7.135V5.193a1.17 1.17 0 0 0-1.17-1.17h-3.294zm0 8.559c-.31 0-.608.123-.828.343l-4.889 4.889a1.17 1.17 0 0 1-.827.343h-2.04a1.17 1.17 0 0 0-1.17 1.2l.052 1.984a1.17 1.17 0 0 0 1.17 1.14h2.37c.31 0 .607-.124.827-.343l4.93-4.93c.22-.22.517-.343.827-.343h2.873a1.17 1.17 0 0 0 1.17-1.17v-1.943a1.17 1.17 0 0 0-1.17-1.17h-3.294Z"/></svg>
|
||||
|
After Width: | Height: | Size: 1.0 KiB |
@@ -51,4 +51,5 @@
|
||||
gap: var(--spacing-3);
|
||||
max-width: 500px;
|
||||
padding: 24px;
|
||||
max-height: 100%;
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import apacheDruidUrl from '@/assets/Logos/apache-druid.svg';
|
||||
import apiGatewayUrl from '@/assets/Logos/api-gateway.svg';
|
||||
import argocdUrl from '@/assets/Logos/argocd.svg';
|
||||
import aspnetUrl from '@/assets/Logos/aspnet.svg';
|
||||
import auth0Url from '@/assets/Logos/auth0.svg';
|
||||
import autogenUrl from '@/assets/Logos/autogen.svg';
|
||||
import awsAlbUrl from '@/assets/Logos/aws-alb.svg';
|
||||
import azureAppServiceUrl from '@/assets/Logos/azure-app-service.svg';
|
||||
@@ -27,6 +28,7 @@ import claudeCodeUrl from '@/assets/Logos/claude-code.svg';
|
||||
import clickhouseUrl from '@/assets/Logos/clickhouse.svg';
|
||||
import cloudflareUrl from '@/assets/Logos/cloudflare.svg';
|
||||
import cloudwatchLogsUrl from '@/assets/Logos/cloudwatch-logs.svg';
|
||||
import cohereUrl from '@/assets/Logos/cohere.svg';
|
||||
import confluentKafkaUrl from '@/assets/Logos/confluent-kafka.svg';
|
||||
import convexLogoUrl from '@/assets/Logos/convex-logo.svg';
|
||||
import cppUrl from '@/assets/Logos/cpp.svg';
|
||||
@@ -75,6 +77,7 @@ import grokUrl from '@/assets/Logos/grok.svg';
|
||||
import groqUrl from '@/assets/Logos/groq.svg';
|
||||
import hasuraUrl from '@/assets/Logos/hasura.svg';
|
||||
import haystackUrl from '@/assets/Logos/haystack.svg';
|
||||
import hcpVaultUrl from '@/assets/Logos/hcp-vault.svg';
|
||||
import herokuUrl from '@/assets/Logos/heroku.svg';
|
||||
import honeycombUrl from '@/assets/Logos/honeycomb.svg';
|
||||
import hostmetricsUrl from '@/assets/Logos/hostmetrics.svg';
|
||||
@@ -92,6 +95,7 @@ import kafkaUrl from '@/assets/Logos/kafka.svg';
|
||||
import kubernetesUrl from '@/assets/Logos/kubernetes.svg';
|
||||
import lambdaUrl from '@/assets/Logos/lambda.svg';
|
||||
import langchainUrl from '@/assets/Logos/langchain.svg';
|
||||
import langflowUrl from '@/assets/Logos/langflow.svg';
|
||||
import langtraceUrl from '@/assets/Logos/langtrace.svg';
|
||||
import litellmUrl from '@/assets/Logos/litellm.svg';
|
||||
import livekitUrl from '@/assets/Logos/livekit.svg';
|
||||
@@ -3937,6 +3941,58 @@ const onboardingConfigWithLinks = [
|
||||
],
|
||||
link: '/docs/claude-code-monitoring/',
|
||||
},
|
||||
{
|
||||
dataSource: 'cohere',
|
||||
label: 'Cohere',
|
||||
imgUrl: cohereUrl,
|
||||
tags: ['LLM Monitoring'],
|
||||
module: 'apm',
|
||||
relatedSearchKeywords: [
|
||||
'cohere',
|
||||
'cohere api',
|
||||
'cohere logs',
|
||||
'cohere metrics',
|
||||
'cohere monitoring',
|
||||
'cohere observability',
|
||||
'cohere traces',
|
||||
'llm',
|
||||
'llm monitoring',
|
||||
'logging',
|
||||
'logs',
|
||||
'metrics',
|
||||
'monitoring',
|
||||
'observability',
|
||||
'otel cohere integration',
|
||||
'telemetry',
|
||||
],
|
||||
link: '/docs/cohere-monitoring/',
|
||||
},
|
||||
{
|
||||
dataSource: 'langflow',
|
||||
label: 'Langflow',
|
||||
imgUrl: langflowUrl,
|
||||
tags: ['LLM Monitoring'],
|
||||
module: 'apm',
|
||||
relatedSearchKeywords: [
|
||||
'langflow',
|
||||
'langflow logs',
|
||||
'langflow metrics',
|
||||
'langflow monitoring',
|
||||
'langflow observability',
|
||||
'langflow traces',
|
||||
'llm',
|
||||
'llm monitoring',
|
||||
'logging',
|
||||
'logs',
|
||||
'low code ai',
|
||||
'metrics',
|
||||
'monitoring',
|
||||
'observability',
|
||||
'otel langflow integration',
|
||||
'telemetry',
|
||||
],
|
||||
link: '/docs/langflow-observability/',
|
||||
},
|
||||
{
|
||||
dataSource: 'deepseek-api',
|
||||
label: 'DeepSeek API',
|
||||
@@ -6467,6 +6523,30 @@ const onboardingConfigWithLinks = [
|
||||
id: 'cert-manager',
|
||||
link: '/docs/infrastructure-monitoring/cert-manager/',
|
||||
},
|
||||
{
|
||||
dataSource: 'pgbouncer',
|
||||
label: 'PgBouncer',
|
||||
imgUrl: postgresqlUrl,
|
||||
tags: ['infrastructure monitoring', 'metrics'],
|
||||
module: 'metrics',
|
||||
relatedSearchKeywords: [
|
||||
'connection pooler',
|
||||
'connection pooling',
|
||||
'database',
|
||||
'metrics',
|
||||
'monitoring',
|
||||
'observability',
|
||||
'opentelemetry pgbouncer',
|
||||
'pgbouncer',
|
||||
'pgbouncer metrics',
|
||||
'pgbouncer monitoring',
|
||||
'pgbouncer observability',
|
||||
'postgres',
|
||||
'postgresql',
|
||||
],
|
||||
id: 'pgbouncer',
|
||||
link: '/docs/metrics-management/opentelemetry-pgbouncer/',
|
||||
},
|
||||
{
|
||||
dataSource: 'graphql',
|
||||
label: 'GraphQL',
|
||||
@@ -6491,6 +6571,28 @@ const onboardingConfigWithLinks = [
|
||||
id: 'graphql',
|
||||
link: '/docs/instrumentation/javascript/opentelemetry-graphql/',
|
||||
},
|
||||
{
|
||||
dataSource: 'opentelemetry-ebpf',
|
||||
label: 'OpenTelemetry eBPF (OBI)',
|
||||
imgUrl: opentelemetryUrl,
|
||||
tags: ['apm/traces'],
|
||||
module: 'apm',
|
||||
relatedSearchKeywords: [
|
||||
'auto instrumentation',
|
||||
'ebpf',
|
||||
'obi',
|
||||
'opentelemetry ebpf',
|
||||
'opentelemetry obi',
|
||||
'otel ebpf',
|
||||
'zero code instrumentation',
|
||||
'monitoring',
|
||||
'observability',
|
||||
'traces',
|
||||
'tracing',
|
||||
],
|
||||
id: 'opentelemetry-ebpf',
|
||||
link: '/docs/instrumentation/opentelemetry-ebpf/',
|
||||
},
|
||||
{
|
||||
dataSource: 'railway',
|
||||
label: 'Railway',
|
||||
@@ -6513,6 +6615,54 @@ const onboardingConfigWithLinks = [
|
||||
id: 'railway',
|
||||
link: '/docs/integrations/outposts/railway/',
|
||||
},
|
||||
{
|
||||
dataSource: 'hcp-vault',
|
||||
label: 'HCP Vault',
|
||||
imgUrl: hcpVaultUrl,
|
||||
tags: ['logs'],
|
||||
module: 'logs',
|
||||
relatedSearchKeywords: [
|
||||
'hashicorp',
|
||||
'hashicorp vault',
|
||||
'hcp',
|
||||
'hcp vault',
|
||||
'hcp vault logs',
|
||||
'hcp vault monitoring',
|
||||
'hcp vault observability',
|
||||
'log forwarding',
|
||||
'logging',
|
||||
'logs',
|
||||
'monitoring',
|
||||
'observability',
|
||||
'secrets management',
|
||||
'vault',
|
||||
],
|
||||
id: 'hcp-vault',
|
||||
link: '/docs/integrations/outposts/hcp-vault/',
|
||||
},
|
||||
{
|
||||
dataSource: 'auth0',
|
||||
label: 'Auth0',
|
||||
imgUrl: auth0Url,
|
||||
tags: ['logs'],
|
||||
module: 'logs',
|
||||
relatedSearchKeywords: [
|
||||
'auth0',
|
||||
'auth0 logs',
|
||||
'auth0 monitoring',
|
||||
'auth0 observability',
|
||||
'authentication',
|
||||
'authorization',
|
||||
'identity',
|
||||
'log forwarding',
|
||||
'logging',
|
||||
'logs',
|
||||
'monitoring',
|
||||
'observability',
|
||||
],
|
||||
id: 'auth0',
|
||||
link: '/docs/integrations/outposts/auth0/',
|
||||
},
|
||||
{
|
||||
dataSource: 'aspnet-core-metrics',
|
||||
label: 'ASP.NET Core Metrics',
|
||||
|
||||
@@ -648,3 +648,176 @@ describe('getQueryContextAtCursor - trailing dot in key/value', () => {
|
||||
expect(ctx.keyToken).toBe('k8s.namespace');
|
||||
});
|
||||
});
|
||||
|
||||
describe('getQueryContextAtCursor - partial operator', () => {
|
||||
it('treats text after an incomplete key as an operator prefix', () => {
|
||||
const q = 'service.name c';
|
||||
const ctx = getQueryContextAtCursor(q, q.length);
|
||||
|
||||
expect(ctx.isInOperator).toBe(true);
|
||||
expect(ctx.isInKey).toBe(false);
|
||||
expect(ctx.keyToken).toBe('service.name');
|
||||
expect(ctx.operatorToken).toBe('c');
|
||||
expect(ctx.currentPair).toStrictEqual(
|
||||
expect.objectContaining({
|
||||
key: 'service.name',
|
||||
operator: 'c',
|
||||
position: expect.objectContaining({
|
||||
operatorStart: 13,
|
||||
operatorEnd: 13,
|
||||
}),
|
||||
}),
|
||||
);
|
||||
});
|
||||
|
||||
it('keeps the operator context while completing contains', () => {
|
||||
const q = 'service.name cont';
|
||||
const ctx = getQueryContextAtCursor(q, q.length);
|
||||
|
||||
expect(ctx.isInOperator).toBe(true);
|
||||
expect(ctx.keyToken).toBe('service.name');
|
||||
expect(ctx.operatorToken).toBe('cont');
|
||||
});
|
||||
|
||||
it('treats cursor mid-token as operator context', () => {
|
||||
const q = 'service.name cont';
|
||||
// cursor sits between "con" and "t" — user still typing the operator
|
||||
const ctx = getQueryContextAtCursor(q, 15);
|
||||
|
||||
expect(ctx.isInOperator).toBe(true);
|
||||
expect(ctx.isInKey).toBe(false);
|
||||
expect(ctx.keyToken).toBe('service.name');
|
||||
expect(ctx.operatorToken).toBe('cont');
|
||||
});
|
||||
|
||||
it('keeps operator context when an AND conjunction precedes the pair', () => {
|
||||
const q = 'a = 1 AND service.name c';
|
||||
const ctx = getQueryContextAtCursor(q, q.length);
|
||||
|
||||
expect(ctx.isInOperator).toBe(true);
|
||||
expect(ctx.isInKey).toBe(false);
|
||||
expect(ctx.keyToken).toBe('service.name');
|
||||
expect(ctx.operatorToken).toBe('c');
|
||||
expect(ctx.currentPair).toStrictEqual(
|
||||
expect.objectContaining({
|
||||
key: 'service.name',
|
||||
operator: 'c',
|
||||
position: expect.objectContaining({
|
||||
operatorStart: 23,
|
||||
operatorEnd: 23,
|
||||
}),
|
||||
}),
|
||||
);
|
||||
});
|
||||
|
||||
it('keeps operator context when an open parenthesis precedes the pair', () => {
|
||||
const q = '(service.name c';
|
||||
const ctx = getQueryContextAtCursor(q, q.length);
|
||||
|
||||
expect(ctx.isInOperator).toBe(true);
|
||||
expect(ctx.isInKey).toBe(false);
|
||||
expect(ctx.keyToken).toBe('service.name');
|
||||
expect(ctx.operatorToken).toBe('c');
|
||||
});
|
||||
|
||||
it('re-glues a partial operator that follows a NOT negation', () => {
|
||||
const q = 'service.name NOT c';
|
||||
const ctx = getQueryContextAtCursor(q, q.length);
|
||||
|
||||
expect(ctx.isInOperator).toBe(true);
|
||||
expect(ctx.isInKey).toBe(false);
|
||||
expect(ctx.keyToken).toBe('service.name');
|
||||
expect(ctx.operatorToken).toBe('NOT c');
|
||||
// operatorStart points at the partial operator (post-NOT), not at the
|
||||
// negation — so suggestion selection only replaces the partial, never
|
||||
// the user's typed NOT.
|
||||
expect(ctx.currentPair).toStrictEqual(
|
||||
expect.objectContaining({
|
||||
key: 'service.name',
|
||||
operator: 'NOT c',
|
||||
hasNegation: true,
|
||||
position: expect.objectContaining({
|
||||
negationStart: 13,
|
||||
negationEnd: 15,
|
||||
operatorStart: 17,
|
||||
operatorEnd: 17,
|
||||
}),
|
||||
}),
|
||||
);
|
||||
});
|
||||
|
||||
it('re-glues a multi-character partial operator after NOT', () => {
|
||||
const q = 'service.name NOT lik';
|
||||
const ctx = getQueryContextAtCursor(q, q.length);
|
||||
|
||||
expect(ctx.isInOperator).toBe(true);
|
||||
expect(ctx.keyToken).toBe('service.name');
|
||||
expect(ctx.operatorToken).toBe('NOT lik');
|
||||
expect(ctx.currentPair?.hasNegation).toBe(true);
|
||||
});
|
||||
|
||||
it('re-glues an uppercase partial operator after NOT', () => {
|
||||
const q = 'service.name NOT EXI';
|
||||
const ctx = getQueryContextAtCursor(q, q.length);
|
||||
|
||||
expect(ctx.isInOperator).toBe(true);
|
||||
expect(ctx.keyToken).toBe('service.name');
|
||||
expect(ctx.operatorToken).toBe('NOT EXI');
|
||||
expect(ctx.currentPair?.hasNegation).toBe(true);
|
||||
});
|
||||
|
||||
it('preserves original NOT casing in the operator text', () => {
|
||||
const q = 'service.name not c';
|
||||
const ctx = getQueryContextAtCursor(q, q.length);
|
||||
|
||||
expect(ctx.isInOperator).toBe(true);
|
||||
expect(ctx.keyToken).toBe('service.name');
|
||||
expect(ctx.operatorToken).toBe('not c');
|
||||
expect(ctx.currentPair?.hasNegation).toBe(true);
|
||||
});
|
||||
|
||||
it('tolerates extra whitespace between NOT and the partial operator', () => {
|
||||
const q = 'service.name NOT c';
|
||||
const ctx = getQueryContextAtCursor(q, q.length);
|
||||
|
||||
expect(ctx.isInOperator).toBe(true);
|
||||
expect(ctx.keyToken).toBe('service.name');
|
||||
// Display text uses a canonical single space between NOT and the
|
||||
// partial, regardless of how many spaces the user typed.
|
||||
expect(ctx.operatorToken).toBe('NOT c');
|
||||
expect(ctx.currentPair?.hasNegation).toBe(true);
|
||||
});
|
||||
|
||||
it('keeps operator context for NOT-prefixed partial inside parentheses', () => {
|
||||
const q = '(service.name NOT c';
|
||||
const ctx = getQueryContextAtCursor(q, q.length);
|
||||
|
||||
expect(ctx.isInOperator).toBe(true);
|
||||
expect(ctx.keyToken).toBe('service.name');
|
||||
expect(ctx.operatorToken).toBe('NOT c');
|
||||
expect(ctx.currentPair?.hasNegation).toBe(true);
|
||||
});
|
||||
|
||||
it('keeps operator context for NOT-prefixed partial after an AND conjunction', () => {
|
||||
const q = 'a = 1 AND service.name NOT c';
|
||||
const ctx = getQueryContextAtCursor(q, q.length);
|
||||
|
||||
expect(ctx.isInOperator).toBe(true);
|
||||
expect(ctx.keyToken).toBe('service.name');
|
||||
expect(ctx.operatorToken).toBe('NOT c');
|
||||
expect(ctx.currentPair?.hasNegation).toBe(true);
|
||||
});
|
||||
|
||||
it('re-glues the most recent incomplete pair when three partial tokens are typed', () => {
|
||||
// Pins documented behavior: with two trailing partial pairs (`c` and
|
||||
// `k`), the heuristic pairs the most recent two — `c` becomes the
|
||||
// key, `k` becomes the partial operator. The earlier `service.name`
|
||||
// is dropped from the current pair view.
|
||||
const q = 'service.name c k';
|
||||
const ctx = getQueryContextAtCursor(q, q.length);
|
||||
|
||||
expect(ctx.isInOperator).toBe(true);
|
||||
expect(ctx.keyToken).toBe('c');
|
||||
expect(ctx.operatorToken).toBe('k');
|
||||
});
|
||||
});
|
||||
|
||||
@@ -605,6 +605,98 @@ export function getQueryContextAtCursor(
|
||||
queryPairs,
|
||||
);
|
||||
|
||||
// Re-glue a partial operator that ANTLR has lexed as a second key.
|
||||
//
|
||||
// When the user types `service.name c` (or `service.name NOT c`), the
|
||||
// lexer sees two KEY tokens (`service.name`, `c`) instead of a key +
|
||||
// partial operator, so `extractQueryPairs` emits two consecutive
|
||||
// key-only incomplete pairs. Downstream, that makes the dropdown
|
||||
// suggest keys when it should be suggesting operators.
|
||||
//
|
||||
// Detect that pattern — a previous incomplete key-only pair followed
|
||||
// by another incomplete key-only `currentPair`, separated only by
|
||||
// whitespace (or by a negation token attached to the previous pair) —
|
||||
// and rebuild a single synthetic pair where the previous pair's key
|
||||
// is the key and the current pair's key is treated as the partial
|
||||
// operator. The synthetic pair inherits the previous pair's negation
|
||||
// flag and positions via the spread, so `NOT <partial>` propagates
|
||||
// correctly to consumers.
|
||||
const previousIncompletePair = queryPairs
|
||||
.filter(
|
||||
(pair) =>
|
||||
!pair.isComplete &&
|
||||
!!pair.key &&
|
||||
!pair.operator &&
|
||||
pair.position.keyEnd < (currentPair?.position.keyStart ?? cursorIndex),
|
||||
)
|
||||
.sort((a, b) => b.position.keyEnd - a.position.keyEnd)[0];
|
||||
|
||||
if (
|
||||
previousIncompletePair &&
|
||||
currentPair &&
|
||||
currentPair !== previousIncompletePair &&
|
||||
!currentPair.operator &&
|
||||
currentPair.position.keyStart > previousIncompletePair.position.keyEnd
|
||||
) {
|
||||
const negationStart = previousIncompletePair.position.negationStart ?? 0;
|
||||
const negationEnd = previousIncompletePair.position.negationEnd ?? 0;
|
||||
const negationAfterKey =
|
||||
previousIncompletePair.hasNegation &&
|
||||
negationStart > previousIncompletePair.position.keyEnd;
|
||||
const gapStart = negationAfterKey
|
||||
? negationEnd + 1
|
||||
: previousIncompletePair.position.keyEnd + 1;
|
||||
const textBetweenPairs = query.slice(
|
||||
gapStart,
|
||||
currentPair.position.keyStart,
|
||||
);
|
||||
|
||||
if (textBetweenPairs.trim() === '') {
|
||||
// The replacement range (operatorStart/operatorEnd) must point
|
||||
// at the partial operator only, NOT the leading negation.
|
||||
// Consumers like QuerySearch use it to splice the chosen
|
||||
// suggestion in-place, so including the negation would let a
|
||||
// `NOT lik` -> `LIKE` selection erase the user's typed `NOT`.
|
||||
// Matches the convention used for complete pairs in
|
||||
// extractQueryPairs, where operatorStart starts after the
|
||||
// negation token.
|
||||
const operatorStart = currentPair.position.keyStart;
|
||||
const operatorEnd = currentPair.position.keyEnd;
|
||||
const partialOperator = query.slice(operatorStart, operatorEnd + 1);
|
||||
const operatorText = negationAfterKey
|
||||
? `${query.slice(negationStart, negationEnd + 1)} ${partialOperator}`
|
||||
: partialOperator;
|
||||
|
||||
return {
|
||||
tokenType: -1,
|
||||
text: '',
|
||||
start: cursorIndex,
|
||||
stop: cursorIndex,
|
||||
currentToken: operatorText,
|
||||
isInKey: false,
|
||||
isInNegation: false,
|
||||
isInOperator: true,
|
||||
isInValue: false,
|
||||
isInConjunction: false,
|
||||
isInFunction: false,
|
||||
isInParenthesis: false,
|
||||
isInBracketList: false,
|
||||
keyToken: previousIncompletePair.key,
|
||||
operatorToken: operatorText,
|
||||
queryPairs,
|
||||
currentPair: {
|
||||
...previousIncompletePair,
|
||||
operator: operatorText,
|
||||
position: {
|
||||
...previousIncompletePair.position,
|
||||
operatorStart,
|
||||
operatorEnd,
|
||||
},
|
||||
},
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
// Check if cursor is within any of the specific context boundaries
|
||||
// FIXED: Include the case where the cursor is exactly at the end of a boundary
|
||||
const isInKeyBoundary =
|
||||
|
||||
Reference in New Issue
Block a user